Skip to content

Instantly share code, notes, and snippets.

Jake Marsh jakemarsh

View GitHub Profile
@jakemarsh
jakemarsh / 1-chainable.swift
Last active Aug 29, 2015
little-bites-of-cocoa-002-chainable-methods
View 1-chainable.swift
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 }
View lines_of_code.rb
#!/usr/bin/env ruby
# encoding: UTF-8
require 'optparse'
class File
def self.binary?(name)
fstat = stat(name)
return false unless fstat.file?
View nginx.conf
user www;
worker_processes 4;
error_log logs/error.log;
pid temp/nginx.pid;
events {
worker_connections 1024;
}
http {
@jakemarsh
jakemarsh / WTFCGrect.m
Created Apr 4, 2013
Wanna be cooler than all your friends? Create your CGRects like this!
View WTFCGrect.m
(CGRect){ .size = size, .origin = CGPointMake(31, 257)}
View gist:1715222
<a href="http://bit.ly/AmayLx"> http://bit.ly/AmayLx</a>
@jakemarsh
jakemarsh / reset_simulator.applescript
Created Jan 20, 2012
Simple Applescript that can be run from the command line to programmatically reset the iOS simulator.
View reset_simulator.applescript
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 Jan 11, 2012
Interview Question
View gist:1596622
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 Oct 16, 2011
Is This Cool? Or No?
View Cool.m
- (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;
View gist:1278352
- (id) init {
self = [super init];
if(!self) return nil;
self.someProperty = 123;
return self;
}
@jakemarsh
jakemarsh / BestClassEver.m
Created Feb 12, 2011
The simplest thing makes a word of difference
View BestClassEver.m
//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;
You can’t perform that action at this time.