Skip to content

Instantly share code, notes, and snippets.

View probablycorey's full-sized avatar
πŸ‘―β€β™‚οΈ
Dancing with my twin

Corey Johnson probablycorey

πŸ‘―β€β™‚οΈ
Dancing with my twin
View GitHub Profile
xml = {tagName = {
attrs = {attr1 = "1", attr2 = "2"},
text = "text",
child1 = {...},
child2 = {...}}
-- attrs
xml.attrs.attr1
-- text
users = User.find(:all, :sort => "previous_worth", :order => "DESC")
users.each_with_index do |u, i|
u.rank = i
if u.previous_worth <= worth
break
end
end
# Super simple markup
Β«header listen upΒ»
Β«subhead I'm here to tell you guys somethingΒ»
hello Β«bold corey is my nameΒ» and I would like to Β«red go to the storeΒ»
# Some sort of style sheet
header {
font-size 10
-- Note: Lua Proxy Userdata is what holds the reference to the obj-c object
function dummyCode(array) -- array is an instance of an obj-c NSArray Object
local thing = NSObject:alloc():init() -- Assume the Lua Proxy Userdata for 'thing' is
-- automatically put into the strong set
... -- Misc Lua code. Assume the Lua garbage collector will be run during this code. Since
-- 'thing' is not being retained by any other obj-c code (its retain count is 1) it is
-- removed from the strong set.
-- usage: lua luac.lua [file.lua]* [-L [module.lua]*]
--
-- creates a precompiled chunk that preloads all modules listed after
-- -L and then runs all programs listed before -L.
--
-- assumptions:
-- file xxx.lua contains module xxx
-- '/' is the directory separator (could have used package.config)
-- int and size_t take 4 bytes (could have read sizes from header)
-- does not honor package.path
imageView = UI.ImageView:initWithFrame(CGRect(10, 10, width, height))
imageView:setImage(image)
imageView:setUserInteractionEnabled(true)
function imageView.touchesEnded_withEvent(self, touches, event)
puts("BY THE DEVIL")
end
require "ListingViewController"
class{..., UI.TableViewController, protocols = {"UITableViewDelegate", "UITableViewDataSource"}}
function dealloc()
super()
end
-- DataSource
-------------
oo
βˆ†()!
/\
class("SimpleTableViewController", "UITableViewController")
function tableView_numberOfSectionsInTableView(tableView, section)
return 1
end
function tableView_numberOfRowsInSection(tableView, section)
return 1
end
#import <Foundation/Foundation.h>
#import "Detective.h"
@interface TwitterStatus : Detective
}
@property (nonatomic, retain) NSNumber *twitterID
@property (nonatomic, retain) NSString *text
@end