This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @namespace cn.orz.pascal | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.js | |
// @include http://d.hatena.ne.jp/* | |
// ==/UserScript== | |
$(function(){ | |
var node = $("/html/body/div"); | |
node.css("background-color","orange"); | |
alert(node[0]); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'open-uri' | |
require 'uri' | |
require 'tmpdir' | |
require 'fileutils' | |
require 'digest/md5' | |
id = "koduki" | |
sound = '/usr/share/sounds/purple/receive.wav' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name url2thum | |
// @namespace pascal.orz.cn | |
// @include http://*.2ch.net/* | |
// ==/UserScript== | |
var ExObject = function(){ | |
var obj = this; | |
this.replace_html = function(filter){ | |
obj.innerHTML = filter(obj.innerHTML); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArrayList implments List{ | |
private Object[] buff = null; | |
private int last = 0; | |
public ArrayList(){ this(128); } | |
public ArrayList(int n){ | |
buff = new Object[n]; | |
} | |
public add(Object o ){ | |
if (last == buff.length) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArrayMap{ | |
class Entry{ | |
Object key; | |
Object value; | |
Entry(object k, object v){ | |
this.key = k; | |
this.value = v; | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int fib(n){ | |
if (n < 2) return n; | |
else return fib(n-2) + fib(n-1); | |
} | |
int main(){ | |
int n = 39; | |
printf("39 : %d\n", fib(n)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'webrick' | |
include WEBrick | |
module Termtter::Client | |
add_command /^serv\s*$/ do |m,t| | |
Thread.new do | |
serv = WEBrick::HTTPServer.new(:Port => 2110) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'webrick' | |
include WEBrick | |
module Termtter::Client | |
add_command /^serv\s*$/ do |m,t| | |
Thread.new do | |
serv = WEBrick::HTTPServer.new(:Port => 2110) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fib(0) -> 0; | |
fib(1) -> 1; | |
fib(N) -> fib(N - 2) + fib(N - 1). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@cache = {} | |
def fib(n) | |
if @cache.has_key? n | |
@cache[n] | |
else | |
r = (n == 0) ? 1: | |
(n == 1) ? 1: | |
fib(n-1) + fib(n-2) | |
@cache[n] = r | |
r |