Skip to content

Instantly share code, notes, and snippets.

@anekos
anekos / gist:50003
Created January 21, 2009 15:40
スコープを作る - io language
# スコープを作るメソッド
scope := method(
expr := call message arguments first
context := Object clone
msg := message(do)
msg setNext(expr)
context prependProto(call sender)
context forward := method(
self proto doMessage(call message clone do( setNext(nil) ))
)
@anekos
anekos / call-sender.io
Created January 26, 2009 01:39
関数呼び出し元のローカル変数を参照&変更する
Foo := Object clone
Foo bar := method(
# 呼び出し元の値を参照
call sender v println
# 呼び出し元の値を書き換え!
call sender v = "new value"
)
Object clone do(
v := "local value"
@anekos
anekos / gist:78087
Created March 12, 2009 14:24
美人時計
import System.IO
import Network.URI
import Network.HTTP
import Network.Stream
import Control.Concurrent
padnum n | n < 10 = '0' : show n
| otherwise = show n
filename h m = padnum h ++ padnum m ++ ".jpg"
@anekos
anekos / Google Translater on LimeChat2
Created November 30, 2009 09:27
LimeChat2 でチャンネルの発言を翻訳する
// 動作させるチャンネル名のパターン
var channelPattern = /#(vimperator|anekos)@.*/;
// 色々置換したりする
function textFilter (s) {
return s;
}
function event::onLoad(){
log('onLoad - google translator');
// @name Session Manager
// @description for "Session Manager" addon
// @description-ja for "Session Manager" addon
// @license Creative Commons 2.1 (Attribution + Share Alike)
// @version 1.0
// @author anekos (anekos@snca.net)
// @maxVersion 2.0pre
// @minVersion 2.0pre
// ==/VimperatorPlugin==
//
@anekos
anekos / gist:257573
Created December 16, 2009 04:00 — forked from teramako/dealCards.js
カード配り (10分プログラミング)
//テーマはvar, letを使わないこと
(function(n,c)c.match('(.{'+n+'})+')[0].split("").reduce(function(p,c,i)(p[i%n]=(p[i%n]||'')+c,p),[]))(6,"01234501234501234578")
@anekos
anekos / temp.js
Created December 22, 2009 14:14
Vimperator のコードテスト用スクリプトテンプレ
(function(){
// util function
// {{{
let echo = function (str) {
setTimeout(function () liberator.echo(str), 100);
};
let log = liberator.log;
let dlog = function (delay, func) {
setTimeout(function () log(func()), delay * 1000);
};
@anekos
anekos / vimp-localization-helper.rb
Created December 24, 2009 13:37
Vimperator ドキュメント翻訳補助スクリプト
#!/usr/bin/ruby
require "rexml/document"
txt_source_dir = 'C:/root/project/coderepos/vimp-doc/2.0/vimperator-help-ja/locale/ja/'
xml_source_dir = 'C:/root/project/vimperator/origin/common/locale/en-US/'
dest_dir = 'c:/root/home/anekos/temp/vimploc/'
txt_source_dir, xml_source_dir, dest_dir = *ARGV if ARGV.size >= 3
const stackPattern = /(zip-de-download|hoge)\.js/;
function popupAlert (iconPath, title, text, buttonEnabled, a, b) {
const ALERT_SVC =
Components.classes["@mozilla.org/alerts-service;1"].
getService(Components.interfaces.nsIAlertsService);
ALERT_SVC.showAlertNotification.apply(ALERT_SVC, arguments);
}
function simplePopupAlert (title, text) {
@anekos
anekos / maze.rb
Created January 12, 2010 13:53
迷路を解くスクリプト - どっかのブログの問題
#!/usr/bin/ruby
class Pos
include Enumerable
attr_reader :x, :y, :route
def initialize (x, y)
@x, @y, @route = x, y, []
end
def each (&block)