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
{ | |
"host": ["api.example.com", "api-staging.example.com"], | |
"headers": { // By default, optional: false | |
"X-EXAMPLE-DEVICE-TYPE": ["iphone", "android"], | |
"X-EXAMPLE-DEVICE-UUID": { | |
"value": "mock", | |
"optional": true | |
}, | |
"X-EXAMPLE-APP-ID": ["com.example.iphone.app1", "com.example.iphone.app2", "com.example.android.app1"] | |
}, |
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
class Api::V1::PhotosController < Api::V1::BaseController | |
class Photo < ::Photo | |
def to_hash | |
# ........ | |
end | |
end | |
def index | |
render :json => Api::V1::PhotosController::Photo.all.collect(&:to_hash).to_json | |
end |
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
{ | |
"host": "api.twitter.com", | |
"api_groups": [ | |
{ | |
"name": "Timelines", | |
"apis": [ | |
{ | |
"name": "GET statuses/public_timeline", | |
"type": "json", | |
"path": "/1/statuses/public_timeline.json", |
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
body { font-family: monospace; font-size: 1.1em; } | |
ul { margin: 0 0 0 .2em; list-style: none; } | |
li { padding: 0; margin: 0;} | |
li:after { content: ','; } | |
li:last-child:after { content: ''; } | |
span.object { font-weight: bold; } | |
span.string, span.string a { color: green; } |
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
diff --git a/app/models/photo.rb b/app/models/photo.rb | |
index 3c44e48..3fc12cc 100644 | |
--- a/app/models/photo.rb | |
+++ b/app/models/photo.rb | |
@@ -190,4 +190,8 @@ class Photo < ActiveRecord::Base | |
def hide | |
update_attribute(:hidden, true) | |
end | |
+ | |
+ def sum_of_collections_count_and_hits_count |
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
@Override | |
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { | |
SQLiteDatabase db = dbHelper.getReadableDatabase(); | |
if(sURIMatcher.match(uri) == EVENTS) { | |
String selectClauses = ""; | |
for(int i=0; i < projection.length; i++) { | |
if(projection[i] == "participants_count") { | |
selectClauses += "(SELECT COUNT(*) FROM participants WHERE participants.event_id = events.event_id)"; | |
} else { | |
selectClauses += projection[i]; |
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
# A sample Gemfile | |
source "http://rubygems.org" | |
gem "rails", "2.3.11" | |
gem "mysql" | |
gem "rdoc" | |
gem "rdoc-data" | |
gem "shoulda", "~> 2.10.3" | |
gem "edavis10-object_daddy", ">= 0" | |
gem "mocha", ">= 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
var links = document.getElementsByClassName('link'); | |
var choose = function() { | |
for(var j=0; j < links.length; j++) { | |
links[j].className = ''; | |
} | |
this.className = 'active'; | |
}; | |
for(var i=0; i < links.length; i++) { | |
links[i].addEventListener('click', choose, false); | |
} |
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
# A sample Guardfile | |
# More info at https://github.com/guard/guard#readme | |
guard 'brakeman' do | |
watch(%r{^app/.+\.(erb|haml|rhtml|rb)$}) | |
watch(%r{^config/.+\.rb$}) | |
watch(%r{^lib/.+\.rb$}) | |
watch('Gemfile') | |
end |
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
{ | |
"data": [ | |
{"title": "黃子華棟篤笑 1990 - 娛樂圈血肉史", "link": "http://www.youtube.com/watch?v=hWQoj0wVuKM"}, | |
{"title": "黃子華棟篤笑 1991 - 色情家庭", "link": "http://www.youtube.com/watch?v=bxm1vKwzzis"}, | |
{"title": "黃子華棟篤笑 1992 - 跟住去邊度", "link": "http://www.youtube.com/watch?v=UmliSnuWPDQ"}, | |
{"title": "黃子華棟篤笑 1994 - 末世財神", "link": "http://www.youtube.com/watch?v=YzSyB4D06-M"}, | |
{"title": "黃子華棟篤笑 1995 - 棟篤笑雙打之玩無可玩", "link": "http://www.youtube.com/watch?v=SyG_c9ziTvY"}, | |
{"title": "黃子華棟篤笑 1997 - 秋前算帳", "link": "http://www.youtube.com/watch?v=MRsz2nMtOSs"}, | |
{"title": "黃子華棟篤笑 1999 - 拾下拾下", "link": "http://www.youtube.com/watch?v=ZEj3bGS6sYc"}, | |
{"title": "黃子華棟篤笑 2003 - 冇碳用", "link": "http://www.youtube.com/watch?v=PPGOSpiujPY"}, |
OlderNewer