Skip to content

Instantly share code, notes, and snippets.

@anekos
anekos / gist:50003
Created Jan 21, 2009
スコープを作る - io language
View gist:50003
# スコープを作るメソッド
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 Jan 26, 2009
関数呼び出し元のローカル変数を参照&変更する
View call-sender.io
Foo := Object clone
Foo bar := method(
# 呼び出し元の値を参照
call sender v println
# 呼び出し元の値を書き換え!
call sender v = "new value"
)
Object clone do(
v := "local value"
View gist:78087
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 Nov 30, 2009
LimeChat2 でチャンネルの発言を翻訳する
View Google Translater on LimeChat2
// 動作させるチャンネル名のパターン
var channelPattern = /#(vimperator|anekos)@.*/;
// 色々置換したりする
function textFilter (s) {
return s;
}
function event::onLoad(){
log('onLoad - google translator');
View sessiong-manager.js
// @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 Dec 16, 2009 — forked from teramako/dealCards.js
カード配り (10分プログラミング)
View gist:257573
//テーマは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 Dec 22, 2009
Vimperator のコードテスト用スクリプトテンプレ
View temp.js
(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 Dec 24, 2009
Vimperator ドキュメント翻訳補助スクリプト
View vimp-localization-helper.rb
#!/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
View override-echo.js
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 Jan 12, 2010
迷路を解くスクリプト - どっかのブログの問題
View maze.rb
#!/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)