Skip to content

Instantly share code, notes, and snippets.

View tomoh1r's full-sized avatar
💭
I may be slow to respond.

NAKAMURA, Tomohiro tomoh1r

💭
I may be slow to respond.
View GitHub Profile
@tomoh1r
tomoh1r / README.rst
Last active December 20, 2015 04:09
Use multi Dropbox account on single Mac OS X

Use multi Dropbox account on single Mac OS X

How to use

$ touch ~/Library/LaunchAgents/local.dropbox.personal.plist

hoge

@tomoh1r
tomoh1r / ziptest.sh
Created April 18, 2013 10:21
zip test ワンライナー、セミコロン無しバージョン
python -c "with getattr(__import__('zipfile', globals(), locals(), [], -1), 'ZipFile')('hoge.zip', 'r') as zfp: print(not bool(zfp.testzip()))"
@tomoh1r
tomoh1r / README.rst
Last active December 15, 2015 01:49
Buildout 用の hogerecipe。 src/hoge.py というファイルを書き出す。 djangorecipe が簡潔にまとまっていたので参考にした。 template (boilerplate ?) に Jinja2 を利用するとどうかと思い書いた。
@tomoh1r
tomoh1r / hoge.js
Last active December 12, 2015 04:08
1. 「0」を出力する 2. 1秒待つ 3. 「1」を出力する 4. 1秒待つ 5. 「2」を出力する see http://techblog.yahoo.co.jp/programming/js_callback/
'use strict';
(function(seq) {
var hoge = function(seq) {
// timeout の秒数 (ms)
var timeout = 1 * 1000;
// 与えられた配列の length が 0 なら終わり
if (seq.length == 0) return;
@tomoh1r
tomoh1r / gjslint.vim
Created January 23, 2013 01:04
自分用
if exists("current_compiler")
finish
endif
let current_compiler = "gjslint"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal
endif
CompilerSet makeprg=gjslint\ %
@tomoh1r
tomoh1r / test.js
Last active December 11, 2015 11:18
function の解釈のタイミングがミソ
'use strict';
(function() {
var proto = Hoge.prototype;
function Hoge() {
// some implements ...
}
// some implements ...
})();
@tomoh1r
tomoh1r / test_prototype.js
Created December 15, 2012 14:36
プロトタイプに何が設定されているか確認
'use strict';
var Hoge = Object.create(null);
var h = Object.create(Hoge);
console.log(Hoge == Object.getPrototypeOf(h));
// => true
@tomoh1r
tomoh1r / test_inherit.py
Created December 15, 2012 14:04
インスタンスについて、親クラスの変数の値を変えたらどうなるか、インスタンス自身の値を変えたらどうなるかテスト
# coding: utf-8
class Hoge(object):
x = 100
hoge = Hoge()
print(hoge.x)
# => 100
@tomoh1r
tomoh1r / some.py
Created November 23, 2015 13:04
decorator でラップされた対象を控えておく
>>> lst = []
>>> def deco(f):
... lst.append(f)
...
>>> @deco
... def main():
... pass
...
>>> print(['{f.__module__}.{f.__name__}'.format(f=f) for f in lst])
['__main__.main']