Skip to content

Instantly share code, notes, and snippets.

View LucasVidal's full-sized avatar

Lucas Vidal LucasVidal

View GitHub Profile
import UIKit
import XCTest
// Wasteful and Helpful tests
class SomeViewController {
let model: Model
let statusLabel: UILabel
let buttonColor: UIColor
init(_ model: Model) {
@LucasVidal
LucasVidal / gist:8522914
Created January 20, 2014 16:05
[NSTimezone abbreviationDictionary]
timezones: {
ADT = "America/Halifax";
AKDT = "America/Juneau";
AKST = "America/Juneau";
ART = "America/Argentina/Buenos_Aires";
AST = "America/Halifax";
BDT = "Asia/Dhaka";
BRST = "America/Sao_Paulo";
BRT = "America/Sao_Paulo";
BST = "Europe/London";
var tempText = ":a/b?c,d=e&f"
var replacements = [
(":","%3A"),
("/","%2F"),
("?","%3F"),
(",","%2C"),
("=","%3D"),
("&","%26")]
//Smalltalk's "collect", haskell's "map"
- (NSArray *) arrayByEvaluatingBlock:(id(^)(id object))block {
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[self count]];
for (id object in self) {
[array addObject:block(object)];
}
return [array copy];
}
//Smalltalk's and haskell's "filter"