Better HN
topnewbestaskshowjobs
Log inSign up

sharkbrainguy

402 karma · joined Jun 22, 2008 (18y ago) · 140 submissions

I'm a developer, animator, standup comedian in New Zealand.

http://www.gerardpaapu.com/

gerard@gerardpaapu.com

Submissions

comment 13y ago · link · parent

Is this helpful? http://en.wordpress.com/windows-live-writer/

comment 13y ago · link · parent

2004 seems really late for the inception (or possibly formalisation) of Domain Specific Language, I assume that you're talking specifically about embedded (also called internal) DSLs, otherwise SQL at least is from 1986.

As an earlier example of an Embedded DSL, the book PAIP[1] included prolog embedded in common lisp in 1992.

It could be argued that the loop macro in Common Lisp is a DSL for describing iteration. If not loop, then certainly regular expressions are a common EDSL for describing a regular language, and performing operations with those languages against strings?

I found this snippet from Computers in Crisis [2] which seems to describe domain-specific languages in familiar terms from 1975

    Most domain-specific programming languages can be categorized in one
    of two ways; either as a "sugared" general ... of programming, in
    fact the style of problem solving, embedded in and supported by that
    language remains unchanged.
[1] http://www.norvig.com/paip/README.html [2] http://books.google.co.nz/books?id=QndQAAAAMAAJ&q=%22Embedde...

comment 13y ago · link · parent

It seems like for reduced calorie Coke specifically, it is marketed as "Diet Coke" or "Diet Coca Cola", in at least Australia[1], New Zealand[2], The United Kingdom[3], India, Israel and The US[4].

[1] https://www.coca-cola.com.au/ourdrinks [2] http://coke.co.nz/ [3] http://www.coca-cola.co.uk/brands/diet-coke.html [4] http://en.wikipedia.org/wiki/Diet_coke

comment 13y ago · link · parent

I think you've excluded the middle here, (#1.5 perhaps) one who thinks that your code is worthless/dangerous and does not call you a loser.

It can be true that a piece of software is a poor replacement for an existing tool.

It can be true that recommending it as a replacement for that tool is dangerous.

You can make these judgements about a piece of software without an incident like this happening. What's important here, is how you behave once you've made these judgements.

comment 13y ago · link · parent

I don't think a critique of the code in question is especially relevant to the main point of the article, i.e. the practice of mocking open-source projects.

Debating the technical merits of this particular project can't really address that.

comment 13y ago · link · parent

If you're after a standard library for Javascript, you could do worse than including es5-shim. Which has the advantage of being a library that (partially) implements a standard: Ecmascript 5.

    > es5-shim.js and es5-shim.min.js monkey-patch a
    > JavaScript context to contain all EcmaScript 5
    > methods that can be faithfully emulated with a
    > legacy JavaScript engine.
It provides Array::map, Array::filter, Array::reduce as defined in Ecmascript 5 along with String::trim and others, as well as replacing buggy implementations.

Previous versions of es5-shim included shims for things that cannot be correctly or completely shimmed in ES3 but those have since been separated and I now recommend including es5-shim in basically all web projects to get closer to a modern javascript in most browsers.

comment 13y ago · link · parent

Clearly jQuery isn't providing a lot of the things they are looking for in a standard library, as it is focussed on DOM manipulation and Ruby.js attempts to provide core types like Enumerables and Time.

comment 14y ago · link · parent

You can achieve the same effect without using eval, which his many known problems in terms of security and performance.

        function render(tpl,data){
            function lookup (obj, keys) {
                return (keys.length === 0) ? obj
                :  lookup(obj[keys[0]], keys.slice(1));
            }

            var matches = tpl.match(/\{[^\}]+\}/g),
                max = matches.length,
                i, rep, keys;

            for (i = 0; i < max; i++) {
                keys = matches[i].slice(1, -1).split('.');
                rep = lookup(data, keys);
                tpl = tpl.replace(matches[i],rep);
            }

            return tpl;
        }

        alert(render("{a} is all that i've {b.a} {b.b} {b.c}", {
            a: "this",
            b: {
                a: "ever",
                b: "really",
                c: "needed"
            } 
        }));

comment 14y ago · link · parent

No, Javascript is not "just scheme" with a few bad design decisions. They have significant differences.

Scheme has:

  call-with-current-continuation http://people.csail.mit.edu/jaffer/r4rs_8.html#IDX509
  Tail Call Optimisation
  A numeric tower http://people.csail.mit.edu/jaffer/r4rs_8.html#SEC50
  A Code/Data equivalence and therefore macros
  Ports
Javascript has:

  Prototypal inheritance
  Every 'object' is mutable bag of string indexed properties
There's a pile of differences, even just at the semantic level before you get into the syntax or the equivalence semantics.

I understand that if you take a specific subset of javascript, you can write code as-though it has some scheme semantics (minus call/cc and TCO), but that's true to a similar extent of any language with lexical scope, closures and anonymous functions.

comment 14y ago · link · parent

I have the same reaction,

because I prefer this:

    Q: "How much will lunch cost?"
    A: "$20"
To this:

    Q: "How much will lunch cost?"
    A: "Either $0 or $200"

comment 15y ago · link · parent

I think you're referring to John Key.

http://en.wikipedia.org/wiki/John_Key

comment 15y ago · link · parent

Pandoc does that already http://johnmacfarlane.net/pandoc/

Pandoc is written in haskell but there's c bindings to it https://github.com/toyvo/libpandoc so you can use it from anywhere.

comment 15y ago · link · parent

I would also love an invite: @gmail.com

edit: Invite Received! Email redacted! Thanks alot

comment 15y ago · link · parent

Here's javascript, the other languages are left as an exercise.

    function Kitten(width, height, color) {
        var img, g, w, h;

        w = parseInt(width,  10);
        h = parseInt(height, 10);
        g = color ? "" : "g/";
        img = document.createElement('img');
        img.src = "http://placekitten.com/" + g + w + "/" + h;
        img.width = w;
        img.height = h;

        return img;
    };

comment 15y ago · link · parent

commit only commits changes that have been staged

comment 15y ago · link · parent

    (function foo() {
        console.log("hello world");
        setTimeout(foo, 1000);
    })();

comment 15y ago · link · parent

Most javascript modules are defined inside a similar pattern, I'm surprised you haven't seen it yet.

http://www.adequatelygood.com/2010/3/JavaScript-Module-Patte...

https://github.com/jquery/jquery/blob/master/src/ajax.js

comment 15y ago · link · parent

Chorus makes it super easy to embed live timelines from twitter, facebook, friendfeed, hackernews and github into webpages.

https://github.com/sharkbrainguy/qorus is a port from the original MooTools module https://github.com/sharkbrainguy/Chorus to a jQuery plugin (it's a popularity contest right?).

check out the live demo: http://gerardpaapu.com/qorus/demo/

19.

Chorus: A jQuery plugin for embedding timelines(github.com ↗)

2 points · by sharkbrainguy · 15y ago · 1 comment

comment 15y ago · link · parent

The immediate-function pattern starts with an open paren.

(function () {

}());

comment 15y ago · link · parent

If you're using mootools, I've written a simple wrapper for Embedly (available under BSD).

https://github.com/sharkbrainguy/Chorus/blob/master/Source/E...

comment 15y ago · link · parent

ah, I see I was reading completely wrong

comment 15y ago · link · parent

http://keithmajhor.pastebin.com/xvgVAKve

removed the implicit global

comment 16y ago · link · parent

Good point, I was just using that because that's the domain, I normally use. I've just pushed an update to fix that.

(also I updated the demo)

comment 16y ago · link · parent

sure http://gerardpaapu.com/hncomments/

26.

A jQuery plugin to embed a HN thread in a webpage (uses api.ihackernews.com)(github.com ↗)

13 points · by sharkbrainguy · 16y ago · 5 comments

comment 16y ago · link · parent

can I get dot.ww.com or kapo.ww.com -> gerardpaapu.com

comment 16y ago · link · parent

I think you might have misread the code.

Each `fn` is bound exactly once, `forEach` is not a loop.

comment 16y ago · link · parent

(ITYM js2-mode) No.

I use this to indent my JS: http://www.vim.org/scripts/script.php?script_id=1936

You could use JSLint plugin to get more of the features, but I've never gotten it to feel like js2-mode.

12345