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
device_token = '123abc456def' | |
APNS.send_notification(device_token, 'Hello iPhone!' ) | |
#or | |
APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default') |
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
APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default', | |
:other => {:sent => 'with apns gem'}) |
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
{"aps":{"alert":"Hello iPhone!","badge":1,"sound":"default"},"sent":"with apns gem"} |
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
- (BOOL)application:(UIApplication *)application | |
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge)]; | |
} | |
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { | |
NSLog(@"deviceToken: %@", deviceToken); | |
} |
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
## FRONT END SERVER | |
location ^~ /progress { | |
proxy_pass_header X-Progress-ID; | |
proxy_pass_header X-Request-With; | |
proxy_pass http://174.129.123.123; | |
break; | |
} | |
location /videos { |
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 'rubygems' | |
require 'png' | |
class PNGGradient | |
def initialize(w, h, ca1, ca2) | |
@w = w | |
@h = h | |
Array === ca1 ? @ca1 = ca1 : @ca1 = ca1.hex2dec | |
Array === ca2 ? @ca2 = ca2 : @ca2 = ca2.hex2dec |
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
get %r{^/(\d{1,3})/(\d{1,3})/([0-9A-Fa-f]{6,6})/([0-9A-Fa-f]{6,6})/output.(\w+)$} do |height, width, color1, color2, type| | |
case type | |
when "png" | |
headers 'Content-Type' => 'image/png' | |
png_gradient = PNGGradient.new(width.to_i, height.to_i, "##{color1}", "##{color2}") | |
png_gradient.to_blob() | |
when "html" | |
@height, @width, @color1, @color2 = height, width, color1, color2 | |
haml :png, :layout => false | |
else |
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
#!/usr/local/bin/macruby | |
require 'hotcocoa' | |
framework 'webkit' | |
include HotCocoa | |
application :name => "Test" do |app| | |
app.delegate = self | |
window :frame => [100, 100, 500, 500], :title => "Test" do |win| | |
@web_view = web_view(:layout => {:expand => [:width, :height]}) | |
win << @web_view |
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
- (void)getUsers | |
{ | |
var request = [CPURLRequest requestWithURL:baseURL + "/users.json"]; | |
[request setHTTPMethod: "GET"]; | |
addConnection = [CPURLConnection connectionWithRequest:request delegate:self]; | |
} |
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
#!/usr/local/bin/macruby | |
framework 'AppKit' | |
class Ftang | |
def initialize | |
@app = NSApplication.sharedApplication | |
win = NSWindow.alloc.initWithContentRect([100, 100, 500, 500], |