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
// This gist explains how to setup scalable Parse LiveQuery server on Heroku | |
// Because there is one and only 'web' process on Heroku, it will divide into two Heroku apps: Main and LiveQuery. | |
// A: Main app - All features except for LiveQuery server | |
// Step A1. Setup a Parse app on Heroku | |
// Step A2. Add a Heroku Redis (free plan is enough for testing) | |
// Step A3. Configure Parse app, add redisURL for liveQuery | |
var api = new ParseServer({ | |
... | |
liveQuery: { |
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
dispatch_async(dispatch_get_main_queue(), ^{ | |
// Do something here | |
}); |
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
def who_loves_who | |
yield('Openchan', 'Chikuwa') | |
end | |
who_loves_who do |boy, girl| | |
puts "#{boy} loves #{girl}" | |
end | |
# Results: | |
# |
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
# Associate to a method call with no parameter | |
just_say_hi { puts 'Hi!'} | |
# Associate to a method call with parameters | |
say_hi_to('Andy') { puts 'Hi!' } |
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
def do_twice | |
puts 'Start' | |
yield | |
yield | |
puts 'End' | |
end | |
do_twice { puts 'Hello world!' } | |
# Results: |
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
{ puts "Hello World!" } # this is a block | |
do # | |
puts "Hello World!" # this is also a block | |
end # |
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
# 1.8.* and under | |
player1 = { :name => 'ananfang' } | |
player2 = { :name => 'fatandy' } | |
# 1.9.* | |
player1 = { name: 'ananfang' } | |
player2 = { name: 'fatandy' } |
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
player1 = { 'name' => 'ananfang' } | |
player2 = { 'name' => 'fatandy' } |
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
// | |
// CustomView.h | |
// | |
// Created by Fang Andy on 12/2/3. | |
// Copyright (c) 2012年 Openmouse Studio. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#define UPLOADING_WORDING @"Uploading %i photo(s)..." |
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
// | |
// UIViewController+TopViewController.h | |
// | |
// Created by Fang Andy on 12/2/2. | |
// Copyright (c) 2012年 Openmouse Studio. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface UIViewController (TopViewController) |