Quickly test performance of a function on the console (in the browser) with: var i = performance.now(); yourFunction(); performance.now()-i; Or make a helper function, like this: function performanceTest(testFunction, iterations){ var sum = 0; var start = performance.now(); for(var i = 0; i<iterations;i++){ testFunction(); } var time=performance.now()-start; return time; } And use it like this: pe
Python Decorators vs. Context Managers: Have your cake and eat it! Recently I wrote a decorator that does this: @log_runtime('calling foo') def foo(): do_stuff() Then, deep in some other function, I wanted to do this: with log_runtime('do other stuff'): do_other_stuff() That lead to an important realisations: Conceptually, most real decorators are context managers. I love context managers, so I st
You can keep quick, short-lived personal TODOs as empty commits in the current git branch (original tweet): todo() { git commit --allow-empty -m "TODO: $*" } <i>You can save this either as a shell function or git-todo executable.</i> Use it like so from the command line: todo Check if feature X works under edge-case This records an empty commit prefixed with "TODO". This way git log will remind yo
Create ~/.inputrc and fill it with this: "\e[A": history-search-backward "\e[B": history-search-forward This allows you to search through your history using the up and down arrows … i.e. type "cd" and press the up arrow and you'll search through everything in your history that starts with "cd". It's a little bit like ctrl-r (mentioned in many of the comments below), but anchored to the start of th
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く