-
shellで演算する
echo $((3600*24*3)) # -> 259200 -
実機でJSデバッグする
This file contains hidden or 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
| #!/bin/bash | |
| set -ue | |
| target_dir="__TARGET_DIR__" | |
| backup_dir="__BACKUP_DIR__" | |
| date=$(date +%Y%m%d) | |
| idx=0 |
This file contains hidden or 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
| !!! 5 | |
| %meta(charset="utf-8") | |
| %title Langton's Ant | |
| :coffeescript | |
| # | |
| # original: http://ottati.hatenablog.com/entry/2013/09/16/122423 | |
| # rewrite and customize with haml & coffee-script | |
| # demo: http://jsdo.it/munky69rock/a3Zl | |
| # |
This file contains hidden or 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
| #!/bin/sh | |
| pbpaste | sort | uniq | pbcopy |
This file contains hidden or 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
| #!/bin/sh | |
| # cf:http://www.songmu.jp/riji/archives/2013/06/worker.html | |
| getconf _NPROCESSORS_ONLN |
This file contains hidden or 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
| #!/bin/sh | |
| SHELL=/bin/bash /usr/bin/perldoc -n 'nkf -w | nroff' "$@" |
This file contains hidden or 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
| #!/bin/sh | |
| # http://html2haml.heroku.com/ | |
| set -ue | |
| if [ $# -ne 1 -o ! -e "$1" ]; then | |
| echo "Usage: $0 [path] "; | |
| exit | |
| fi |
This file contains hidden or 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
| # [bash: warning: setlocale: LC_ALL: cannot change locale] | |
| sudo locale-gen ja_JP | |
| sudo update-locale LANG=ja_JP.UTF-8 |
This file contains hidden or 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
| // cf: http://stackoverflow.com/questions/627916/iphone-safari-check-if-url-scheme-is-supported-in-javascript | |
| function checkUrlScheme(app_url_scheme, app_install_url, app_name) { | |
| document.location = app_url_scheme; | |
| setTimeout(function() { | |
| if(confirm('You do not seem to have '+app_name+' installed, do you want to go download it now?')){ | |
| document.location = app_install_url; | |
| } | |
| }, 300); | |
| } |
This file contains hidden or 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
| #!/bin/sh -u | |
| set -e | |
| # origin: http://www.songmu.jp/riji/archives/2012/05/post_379.html | |
| # check: http://d.hatena.ne.jp/masudaK/20120223/1330006586 | |
| if [[ -p /dev/stdin ]];then | |
| tr -d "\r" | vim -R - | |
| else |