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
waxClass{"Store"} | |
function milk() | |
-- milk is added to Store, so you can call it with Store.milk() | |
puts "milk called" | |
end | |
function eggs(self) | |
-- eggs takes a self arg, but you could still call it as a class | |
-- method Store:eggs(). Store would be passed in as 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
require 'rubygems' | |
require 'open-url' | |
require 'plist' | |
states = [] | |
url = "http://somesite.com/states.html" # I forget which site I scrapped. | |
html = open(url).read | |
for state_data in html.scan(/<tr>(.*?)<\/tr>/im) |
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
function applicationDidFinishLaunching(self, application) | |
local frame = UIScreen:mainScreen():bounds() | |
self.window = UIWindow:initWithFrame(frame) | |
self.searchController = SearchController:init() | |
self.window:addSubView(self.searchController:view()) | |
self.window:makeKeyAndVisible() | |
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
luaClass{"DB"} | |
staticDBPath = "db/oscar.db" | |
DBPath = NSDocumentDirectory .. "/oscar-v001.db" | |
function load() | |
if db then return end | |
local fm = NS.FileManager:defaultManager() | |
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 "controllers.Menu" | |
waxClass{"AppDelegate", protocols = {"UIApplicationDelegate"}} | |
function applicationDidFinishLaunching(self, application) | |
math.randomseed(os.time() * os.clock()) -- Randomize Random! | |
self.window = UIWindow:initWithFrame(UIScreen:mainScreen():bounds()) | |
-- cocos2d will inherit these values |
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 /deals # get all the deals | |
-- POST /deals/id # redeem a deal | |
-- GET /user # get the user details | |
-- POST /user/login # login | |
-- POST /user/signup # login | |
-- URL for each social network, will contain a redirect to the networks | |
-- oAuth page. On success will redirect to success://pushkart.com on failure will | |
-- redirect to failure://pushkart.com |
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
// Bad Result | |
// HTTP(PUT) http://pushkart.com/mobile_api/deals/71 | |
{"image_url":"/system/avatars/81/thumb/man_hungry_100x100.jpg?1273866043","redeem_code":null,"title":"$3 off your next Delivery.com order!","message":"Hungry? Me too! At Delivery.com you can order online from your favorite restaurants! http://www.delivery.com/","id":71} | |
// Good Result | |
// HTTP(PUT) http://pushkart.com/mobile_api/deals/31 | |
{"image_url":"/system/avatars/41/thumb/verb_cafe.png?1273805831","redeem_code":"Mention pushkart and your member name to the cashier","title":"10% off our awesome Iced Coffee","message":"Verb Cafe has the best Iced Coffee in town. cold brewed = better taste! http://foursquare.com/venue/3249","id":31} |
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
// Try loading these three urls | |
// [1] http://localhost:8080/goog | |
// [2] http://localhost:8080/google | |
// [3] http://localhost:8080/goog | |
// | |
// The 1 & 2 will load when the google_emitter is called, 3 doesn't but gets called on | |
// the next update | |
var sys = require("sys"), | |
url = require("url"), |
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
[HTTP get:url callback:^ {(HTTPResponse *response, NSError *error) | |
if (error) { | |
// Do something | |
return; | |
} | |
NSLog(@"Response Body %@", response.body); | |
}] |
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)viewDidLoad | |
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)]; | |
v.autoresizingMask = UIViewAutoresizingFlexibleHeight; | |
v.backgroundColor = [UIColor redColor]; | |
[self.scrollView addSubview:v]; | |
} |