Skip to content

Comment on Pictures of kittens for use as placeholders in your designs or code

Comments

I'd like to have bindings for various languages, to be able to use it like

    placeholder=new Kitten('random');

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;
    };
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.