Skip to content

Instantly share code, notes, and snippets.

View jakemarsh's full-sized avatar

Jake Marsh jakemarsh

View GitHub Profile
@jakemarsh
jakemarsh / 1-chainable.swift
Last active August 29, 2015 14:21
little-bites-of-cocoa-002-chainable-methods
enum CountdownType: Int { case ToTheSecond, ToTheDay }
enum ColorScheme: Int { case AfterMidnight, ClassyYellow, Tealfish }
class Concern {
var title: String = ""
func title(aTitle: String?) -> Concern { title = aTitle ?? ""; return self }
var subtitle = ""
func subtitle(aSubtitle: String?) -> Concern { subtitle = aSubtitle ?? ""; return self }
#!/usr/bin/env ruby
# encoding: UTF-8
require 'optparse'
class File
def self.binary?(name)
fstat = stat(name)
return false unless fstat.file?
user www;
worker_processes 4;
error_log logs/error.log;
pid temp/nginx.pid;
events {
worker_connections 1024;
}
http {
@jakemarsh
jakemarsh / WTFCGrect.m
Created April 4, 2013 18:57
Wanna be cooler than all your friends? Create your CGRects like this!
(CGRect){ .size = size, .origin = CGPointMake(31, 257)}
<a href="http://bit.ly/AmayLx"> http://bit.ly/AmayLx</a>
@jakemarsh
jakemarsh / reset_simulator.applescript
Created January 20, 2012 14:57
Simple Applescript that can be run from the command line to programmatically reset the iOS simulator.
tell application "iPhone Simulator"
activate
end tell
tell application "System Events"
tell process "iPhone Simulator"
tell menu bar 1
tell menu bar item "iOS Simulator"
tell menu "iOS Simulator"
click menu item "Reset Content and Settings…"
@jakemarsh
jakemarsh / gist:1596622
Created January 11, 2012 20:35
Interview Question
There is no right answer, just want to get an idea how you would attack the problem.
You have a UITableView that displays images from a web service, you want to make sure it loads those images in a performant, memory conscious way, how would you do it?
@jakemarsh
jakemarsh / Cool.m
Created October 16, 2011 01:37
Is This Cool? Or No?
- (void) viewDidLoad {
[super viewDidLoad];
self.airplaneModeSwitch = [[[UISwitch alloc] initWithFrame:CGRectZero] autorelease];
[self addSection:^(JMStaticContentTableViewSection *section, NSUInteger sectionIndex) {
[section addCell:^(JMStaticContentTableViewCell *staticContentCell, UITableViewCell *cell, NSIndexPath *indexPath) {
staticContentCell.reuseIdentifier = @"UIControlCell";
cell.selectionStyle = UITableViewCellSelectionStyleNone;
- (id) init {
self = [super init];
if(!self) return nil;
self.someProperty = 123;
return self;
}
@jakemarsh
jakemarsh / BestClassEver.m
Created February 12, 2011 04:12
The simplest thing makes a word of difference
//Author: https://github.com/TouchCode
//Code File: https://github.com/TouchCode/TouchUI/blob/master/Source/Views/CBetterAlertView.m
#import <UIKit/UIKit.h>
@interface CBetterAlertView : UIAlertView {
id userInfo;
}
@property (readwrite, nonatomic, retain) id userInfo;