Skip to content

Instantly share code, notes, and snippets.

View alexeckermann's full-sized avatar

Alex Eckermann alexeckermann

View GitHub Profile
@alexeckermann
alexeckermann / server.rb
Created May 14, 2011 06:59
Webrick Server for TumblrThemr
#!/usr/bin/ruby
require 'webrick'
include WEBrick
s = HTTPServer.new(:Port => 3000, :DocumentRoot => Dir::pwd)
['INT', 'TERM'].each { |sig| trap(sig) { s.shutdown } }
s.start
@alexeckermann
alexeckermann / AFTER_main.m
Created January 12, 2011 08:00
Before and after going XIB-less
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, @"UIApplication", @"LapTimerAppDelegate");
[pool release];
return retVal;
}
int (^minusOne)(int);
minusOne = ^(int myNumber) {
return myNumber - 1;
};
NSLog(@"%d", minusOne(3)); // Will print: 2
/*
Example custom UIView implementation
------------------------------------
Used as a custom UITableView header cell.
*/
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
userName = [[UILabel alloc] initWithFrame:CGRectMake(70, 16, (self.bounds.size.width - 70), 28)];