Skip to content

Instantly share code, notes, and snippets.

@ToQoz
ToQoz / js_typeof_instanceof.md
Created Nov 21, 2011
typeof と instanceof について
View js_typeof_instanceof.md

typeof

有用なとき

typeof foo !== 'undefined'

有用でないとき

上記以外.

[上記以外が有用でない理由]

typeofの戻り値は仕様で定義されていないものを返します。よって、実装によって別の結果になる事がある

View htpasswd.rb
#!/usr/bin/env ruby
# Usage
# $ htpasswd.rb 'your_usrename', 'your_password'
# UseCase
# Generate htpasswd for nginx without apache tools.
require "base64"
username, password = ARGV
salt = Base64.encode64((("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a).shuffle[0..7].join)
puts "#{username}:#{password.crypt(salt)}"
View ipynb2py.sh
cat notebook.ipynb | jq -r '.cells[] | select(.cell_type == "code") | select(.source != "") | .source + "\n"' | sed -e 's/\( *\)%.* /\1/'
View codesearch-trial.md

install:

$ go get github.com/google/codesearch/cmd/...

generate indexes:

$ cindex /usr/include /usr/local/include $HOME/_go/src $HOME/_dev
View 0_SVGKit-issue.md

多分 ``  に fill や `style="fill:` の指定が動かない

View register_login_hook_on_osx
$ sudo defaults write com.apple.loginwindow LoginHook /path/to/script
View redshift-unix-timestamp-to-datetime-example.sql
select timestamp 'epoch' + CAST(ts AS BIGINT)/1000 * interval '1 second' from (select 1498783941705 AS ts);
View .tern-project
{
"libs": [
"browser"
],
"plugins": {
"node": {},
"es_modules": {},
"node_resolve": {}
}
}