This file contains 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
// require underscore.js | |
var list = [ | |
['a', 'i', 'u', 'e', 'o'], | |
['k', 'g'], | |
['s', 'z'], | |
['t', 'd'], | |
['n'], | |
['h', 'b', 'p'], | |
['m'], |
This file contains 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
# in user model: | |
# has_many :pins_relationship, class_name: 'Action', conditions: {kind: 'pin'} | |
# has_many :pins, through: :pins_relationship, source: :stuff, uniq: true | |
it "pin place (duplicate check)" do | |
@alice.pins << Stuff.find_or_create_by_kind_and_name!(kind: 'landmark', name: "お気に入り喫茶店") | |
@alice.pins << Stuff.find_or_create_by_kind_and_name!(kind: 'landmark', name: "お気に入り喫茶店") | |
@alice.pins.where(kind: 'landmark', name: "お気に入り喫茶店").count.should == 2 | |
@alice.pins.where(kind: 'landmark', name: "お気に入り喫茶店").size.should == 2 | |
@alice.pins.where(kind: 'landmark', name: "お気に入り喫茶店").length.should == 1 |
This file contains 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
listView.addEventListener("selectionchanged", function(e){ | |
listView.selection.getItems().done(function(res){ | |
console.dir(res); | |
}); | |
}); |
This file contains 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
setInterval(function () { | |
var t = (new Date()).toISOString(); | |
console.log(t); | |
Data.items.getAt(0).title = t; | |
}, 1000); |
This file contains 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
curl -O -b cookie.txt "https://www.facebook.com/ajax/browser/list/allfriends/?uid=<TARGET_ID>&__user=<MY_ID>&__a=1start=0" |
This file contains 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
# Koalaでfacebookの友人の名前を言語表記(この場合は日本語)で取得するサンプル | |
# ref. https://github.com/arsduo/koala/ | |
@graph = Koala::Facebook::API.new(oauth_access_token) | |
@graph.fql_multiquery( | |
{"ids" => "SELECT uid2 FROM friend WHERE uid1=me()", | |
"names" => "SELECT id, name FROM profile WHERE id IN (SELECT uid2 FROM #ids)" }, | |
{:locale => "ja_JP"}) |
This file contains 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 | |
# titaniumでiPadシミュレーターをコマンドラインから起動 | |
python ~/Library/Application\ Support/Titanium/mobilesdk/osx/2.1.1.GA/iphone/builder.py simulator 5.1 "`pwd`" jp.tady.yonkoma yonkoma ipad |
This file contains 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
// 便利のため名前空間を作る | |
WinJS.Namespace.define("SM.Ui.Flyouts", {}); | |
// 一度に複数のフライアウトを設定するときこうすると便利 | |
var flyoutPages = [ | |
{ key: "profile", title: "プロフィール変更", url: "/pages/profileFlyout/profileFlyout.html" }, | |
{ key: "tos", title: "利用規約", url: "/pages/charms/tos.html" }, | |
{ key: "policy", title: "プライバシーポリシー", url: "/pages/charms/policy.html" }, | |
{ key: "logout", title: "ログアウト", url: "/pages/charms/logout.html" }, | |
]; |
This file contains 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
var $prevDiv; | |
$("div").click(function(e){ | |
$this = $(e.currentTarget); | |
console.log(e); | |
if($this.attr("id") !== ""){ | |
$this.css("background-color", "red"); | |
$prevDiv && $prevDiv.css("background-color", "white"); | |
$prevDiv = $this; | |
e.stopPropagation(); | |
} |
This file contains 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
CONFIG = { | |
'language': 'Ruby', | |
# 'executable': 'ruby', | |
'executable': '/Users/<ユーザー名>/.rvm/rubies/ruby-1.9.3-p194/bin/ruby', | |
'lint_args': '-wc' | |
} | |
``` | |
以上で、煩わしい偽Syntax Errorを回避できる。 |
OlderNewer