Skip to content

Instantly share code, notes, and snippets.

View masahitojp's full-sized avatar
🎯
Focusing

Masato Nakamura masahitojp

🎯
Focusing
View GitHub Profile
// ==UserScript==
// @name googleMemorize
// @namespace http://passion.s25.xrea.com/
// @description 前回検索した単語を検索テキストボックスに表示します。
// @include http://www.google.co.jp/*
// @include http://www.google.com/*
// ==/UserScript==
(function(){
/*関数定義*/
// 検索単語を保存
// ==UserScript==
// @include http://api.wassr.jp/statuses/update.json
// ==/UserScript==
location.href='http://wassr.jp/my/'
(defn fib [x]
(cond
(<= x 2) 1
:else (+ (fib (- x 1)) (fib (- x 2)))
))
(. javax.swing.JOptionPane (showMessageDialog nil "Hello World"))
// 連想配列のメンバー数を求める
Object.prototype.len_m=function(){
var i=0;
for(a in this){
if(typeof(this[a])!=="function")i++;
}
return i;
}
var a={"key":"value"};
var loop = function(n,fn){
for(var i=0;i<n;i++)fn();
}
console.time("id1");
loop(3,function(){console.log("hello");});
console.timeEnd("id1");
#!/usr/bin/env python
import time
import datetime
import tornado.httpserver
import tornado.ioloop
import tornado.web
from tornado import websocket
import os
// お題:[本当にLispはカッコが多い?]http://e-arrows.sakura.ne.jp/2010/08/is-lisp-really-has-too-many-parenthesis.html
// Rhinoにて実行可能
// >java -classpath js.jar org.mozilla.javascript.tools.shell.Main fib.js 20
//
for(n=m=1,z=arguments[0]||1;z>=n;n++,m*=n)print(n+"! = "+m)
var BF=(function(){
// "[","]"でジャンプする先をあらかじめ見つけて対応関係を作っておく
var _getJump=function(str){
var pairs=[];
var result=0;
var l=str.length,point = l;
for(var i=0;i<l;i++){
if(str[i]==="["){
result=str.lastIndexOf("]",point)
(define apply-in-underlying-scheme apply)
(define (myeval exp env)
(cond ((self-evaluating? exp) exp)
((variable? exp) (lookup-variable-value exp env))
((quoted? exp) (text-of-quotation exp))
((assignment? exp) (eval-assignment exp env))
((definition? exp) (eval-definition exp env))
((if? exp) (eval-if exp env))
((lambda? exp)
(make-procedure (lambda-parameters exp)