Skip to content

Instantly share code, notes, and snippets.

@hisaos
hisaos / quotationMarkPrecaution
Created March 2, 2014 02:18
Macのテキストエディットと引用符
http://stackoverflow.com/questions/17452045/syntaxerror-invalid-character-u8220
Mac のテキストエディットでプレーンテキストでコードを書いてたら jsc での実行時にエラー。
テキストエディットでは、プレーンテキストでも引用符があかんやつにされてしまいます。
コードは vi とかで書こう。
http://stonedsoul.org/post/116226943/javascript
JS の配列操作について。
splice とか shallow copy について触れられてる。
@hisaos
hisaos / iphonsimulatorDefaults.sh
Created October 22, 2012 01:55
defaults and com.apple.iphonesimulator
# defaults commands with com.apple.iphonesimulator
# usage in detail will show with `defaults` without any arguments
# this sets default simulator device to iPhone
defaults write com.apple.iphonesimulator SimulateDevice -string "iPhone"
defaults write com.apple.iphonesimulator SimulateSDKRoot -string "${SDKROOT_iphonesimulator}"
# this sets default simulator device to iPad
defaults write com.apple.iphonesimulator SimulateDevice -string "iPad"
defaults write com.apple.iphonesimulator SimulateSDKRoot -string "${SDKROOT_iphonesimulator_ipad}"
@hisaos
hisaos / jsObjectKeys.js
Created September 12, 2012 10:33
JS Object.keys()
var obj = {"a":1, "b":2, "c":3 };
Object.keys(obj); // this will return a list of keys in obj
for (var k in obj)
{
// this will iterate over the keys in obj
process.stdout.write(k);
}
@hisaos
hisaos / deg2binTable.js
Created September 5, 2012 05:04
deg2binTable
function deg2binTable(num, pow) {
var result = [];
var maxNum = Math.pow(2, pow - 1);
for(var i = 0; i <= num; i++)
{
var target = i;
var nesNum = maxNum;
var packing = "";
var str = "";