Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Masato Nakamura masahitojp

🎯
Focusing
View GitHub Profile
View gist:38896
// ==UserScript==
// @name googleMemorize
// @namespace http://passion.s25.xrea.com/
// @description 前回検索した単語を検索テキストボックスに表示します。
// @include http://www.google.co.jp/*
// @include http://www.google.com/*
// ==/UserScript==
(function(){
/*関数定義*/
// 検索単語を保存
View wassr-redirect.js
// ==UserScript==
// @include http://api.wassr.jp/statuses/update.json
// ==/UserScript==
location.href='http://wassr.jp/my/'
View gist:339391
(defn fib [x]
(cond
(<= x 2) 1
:else (+ (fib (- x 1)) (fib (- x 2)))
))
View gist:339428
(. javax.swing.JOptionPane (showMessageDialog nil "Hello World"))
View gist:376165
// 連想配列のメンバー数を求める
Object.prototype.len_m=function(){
var i=0;
for(a in this){
if(typeof(this[a])!=="function")i++;
}
return i;
}
var a={"key":"value"};
View gist:381784
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");
View clock_ws.py
#!/usr/bin/env python
import time
import datetime
import tornado.httpserver
import tornado.ioloop
import tornado.web
from tornado import websocket
import os
View factorial.js
// お題:[本当に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)
View bf.js
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)
View metacircular.scm
(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)
You can’t perform that action at this time.