Skip to content

Instantly share code, notes, and snippets.

View ympbyc's full-sized avatar
💭
Lisping in the mountains.

Minori Yamashita ympbyc

💭
Lisping in the mountains.
View GitHub Profile
@ympbyc
ympbyc / bf.js
Created February 12, 2012 15:23
bf
//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 '+':
@ympbyc
ympbyc / カッコじゃないから恥ずかしくないもん.coffee
Created April 8, 2012 14:31
またつまらぬりすぷをかいてしまった. 引数を一つしか取れないようにすれば括弧いらないよねというもの。3時間で適当だしくそい
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
@ympbyc
ympbyc / 1.ympbyc.l
Created April 17, 2012 05:49
man page for ympbyc
\" This is a man page for ympbyc
.TH YMPBYC 1
.SH NAME
ympbyc \- almost full-time programmer
.SH SYNOPSIS
.B ympbyc
.I [options]
.I text...
.SH DESCRIPTION
.I ympbyc
@ympbyc
ympbyc / Ym.js
Created May 10, 2012 15:18
よく使うものだけまとめる
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
@ympbyc
ympbyc / 0.src_router.js
Created May 14, 2012 09:13
titanium mobileの画面遷移をWebアプリのそれっぽく記述したい
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) {
@ympbyc
ympbyc / html.rb
Created June 25, 2012 17:18 — forked from pasberth/html.rb
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
@ympbyc
ympbyc / minimumscore.js
Created July 17, 2012 10:48
書き始めただけでまだ動かない。 -> 動くけどまだやりたい事と違う -> 近い!後で続き
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) {
@ympbyc
ympbyc / memo.el
Created August 6, 2012 13:55
めも
(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以外(=真)なら何もしない
@ympbyc
ympbyc / 00-schel.el
Created August 7, 2012 15:30
minimal scheme with an ability to call elisp functions. elispの練習で書いた
(setq max-lisp-eval-depth 100000)
(setq max-specpdl-size 100000)
(setq debug-on-error t)
(defun compile (x next)
(cond
((symbolp x) (list 'refer x next)) ;;variables
((listp x)
(let ((code (car x)) (arg (cdr x)))
@ympbyc
ympbyc / gist:3302187
Created August 9, 2012 08:04
3impのあれをちょこっと改造してfuncallと同じ書式でホスト言語の関数を呼べるようにした。
;;;;; schel source ;;;;
'(((lambda_ (make-hook add-hook call-hook)
(call-hook (add-hook (make-hook) (lambda_ (e)
(schel message "%s" e)
e)) "hello"))
(lambda_ () (schel make-nil))
(lambda_ (hook fn)
(schel cons fn hook))
(lambda_ (hook data)
(if (schel null hook) (schel make-nil)