2009/04/06


そうだった。そうだった。
Posted at by



2009/03/31


貧乏なので買えません。
カラースターショップ - はてな

ソース
// ==UserScript==
// @name           poor man's hatena color star
// @namespace      http://mattn.kaoriya.net/
// @description    poor man's hatena color star
// @include        http://*
// @include        https://*
// ==/UserScript==

(function() {
    // extend version of $X
    // $X(exp);
    // $X(exp, context);
    // $X(exp, type);
    // $X(exp, context, type);
    function $X (exp, context, type /* want type */{
        if (typeof context == "function"{
            type    = context;
            context = null;
        }
        if (!context) context = document;
        exp = (context.ownerDocument || context).createExpression(exp, function (prefix) {
            return document.createNSResolver((context.ownerDocument === null ? context
                                                                             : context.ownerDocument).documentElement)
                           .lookupNamespaceURI(prefix) ||
                   document.contentType === "application/xhtml+xml" ? "http://www.w3.org/1999/xhtml" : "";
        });

        switch (type) {
            case String:  return exp.evaluate(context, XPathResult.STRING_TYPE, null).stringValue;
            case Number:  return exp.evaluate(context, XPathResult.NUMBER_TYPE, null).numberValue;
            case Boolean: return exp.evaluate(context, XPathResult.BOOLEAN_TYPE, null).booleanValue;
            case Array:
                var result = exp.evaluate(context, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
                for (var ret = [], i = 0, len = result.snapshotLength; i < len; i++) {
                    ret.push(result.snapshotItem(i));
                }
                return ret;
            case undefined:
                var result = exp.evaluate(context, XPathResult.ANY_TYPE, null);
                switch (result.resultType) {
                    case XPathResult.STRING_TYPE : return result.stringValue;
                    case XPathResult.NUMBER_TYPE : return result.numberValue;
                    case XPathResult.BOOLEAN_TYPE: return result.booleanValue;
                    case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
                        // not ensure the order.
                        var ret = [], i = null;
                        while ((i = result.iterateNext())) ret.push(i);
                        return ret;
                }
                return null;
            default: throw(TypeError("$X: specified type is not valid type."));
        }
    }

    var stars = ['star-red.gif', 'star-green.gif', 'star.gif#', 'star-blue.gif'];
    setInterval(function() {
        $X('//img[@src="http://s.hatena.ne.jp/images/star.gif"]').forEach(function(n) {
            n.src = "http://s.hatena.ne.jp/images/" + stars[parseInt(Math.random() * 4)];
        });
    }, 1000);
})();
インストール
poor-mans-hatena-color-star.user.js
Posted at by



2009/03/23


書いた。 use strict;
use warnings;
use lib qw/lib/;
use GNTP::Growl;

my $growl = GNTP::Growl->new(AppName => "my perl app");
$growl->register([
    { Name => "foo", },
    { Name => "bar", },
]);

$growl->notify(
    Event => "foo",
    Title => "おうっふー おうっふー",
    Message => "大事な事なので\n2回言いました",
    Icon => "http://mattn.kaoriya.net/images/logo.png",
);
こんなソースで
perl-gntp-growl
こんな物が動く。
開発はこの辺で...
mattn's perl-gntp-growl at master - GitHub
Posted at by