This file contains 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
#!/usr/bin/python | |
import re | |
class Unbound: pass | |
###utilities### | |
def car(lst): | |
return lst[0] | |
def cdr(lst): | |
return lst[1:len(lst)] |
This file contains 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
var prevpos = 0; //一つ前の状態を管理 | |
var negaeri = function(e){ | |
var x; | |
if (Math.abs((x = Math.floor(e.accelerationIncludingGravity.x)) - prevpos) > 5) | |
{ | |
if ((prevpos < 0 && x < 0) || (prevpos > 0 && x > 0)) return; | |
var stat = (x > -2 && x < 2) ? "上を向いたようです" : (x < prevpos) ? "右に寝返りをうったようです" : "左に寝返りをうったようです"; | |
prevpos = x; | |
var d = new Date(); | |
var tweet = d.getHours() + "時" + d.getMinutes() + "分" + d.getSeconds() + "秒に" + stat + " #negaeri"; |
This file contains 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
(define forrange (lambda (i to fn) | |
(if (>= (+ i 1) to) | |
(fn i) | |
(begin (fn i) | |
((. arguments callee) (+ i 1) to fn))))) | |
(= (. Object prototype get) | |
(lambda (attr) (get this attr))) | |
(= (. Number prototype foreach) |
This file contains 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
//eg: bf('[bfcode]', {input: 'string', display: console.log}) | |
function bf (str, opt) { | |
opt = opt || {}; | |
var mem = new Array(); | |
var ptr = 0; | |
if (!! opt.input) opt.input = opt.input.split(''); | |
mem[0] = 0; | |
for (var i = 0; i < str . length; ++ i) { | |
switch (str[i]) { | |
case '+': |
This file contains 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 Instructions | |
class Refer extends Instructions | |
constructor : (@variable, @next) -> | |
class Close extends Instructions | |
constructor : (@parameter, @body, @next) -> | |
class Frame extends Instructions | |
constructor : (@x, @next) -> | |
class Constant extends Instructions | |
constructor : (@value, @next) -> | |
class Assign extends Instructions |
This file contains 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
function Ym (obj) { | |
// Ym() returns an instance of this Constructor | |
var Constructor = function (obj) { | |
if (obj) | |
for (key in obj) | |
if (obj.hasOwnProperty(key)) | |
this[key] = obj[key] | |
} | |
// Copy the prototype of the object given to our Ym object's prototype | |
// javascript 1.8.2 or lator |
This file contains 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
exports.init = function () { | |
//ナビゲーショングループを入れるための空ウインドウ | |
var rootWin = Ti.UI.createWindow(); | |
this.connect('top', {'rootWin' : rootWin}); | |
} | |
function connect (windowName, cookie) { | |
var watcher, | |
next = function (controller) { | |
return function (cookie) { |
This file contains 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
require 'regparsec' | |
module HTMLParsers | |
extend RegParsec::Regparsers | |
ValidTags = ->(state) { one_of(*state.valid_tags) } | |
OpenTag = between('<', '>', ValidTags) | |
CloseTag = between('</', '>', ValidTags) | |
Line = try /[^\<\n]+/, &:to_s |
This file contains 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
var _ = | |
(function () { | |
var _, Wrapper, result, breaker, slice; | |
breaker = {}; | |
slice = Array.prototype.slice; | |
Wrapper = function(obj) { this._wrapped = obj; }; | |
_ = function (obj) { obj=obj||{}; return new Wrapper(obj) } | |
result = function(obj, chain) { |
This file contains 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
(setq my-key-map nil) ;;初期化しとく | |
(defun hello-world () (interactive) (message "hello world")) ;;なんでinteractiveが要るのかよくわかってない | |
(defun fuck () (interactive) (message "fuck")) | |
(defun hoge () | |
"function hoge" ;;説明? | |
(interactive) ;;この関数(hoge)は対話的に使う | |
(switch-to-buffer "*hackel*") | |
(if my-key-map nil ;;my-key-mapがnil以外(=真)なら何もしない |