Skip to content

Instantly share code, notes, and snippets.

@kharmabum
kharmabum / ocmock-cheatsheet.m
Last active July 30, 2024 07:14
OCMock cheatsheet
/*----------------------------------------------------*/
#pragma mark - XCTAsserts
/*----------------------------------------------------*/
XCTAssert(expression, format...);
XCTAssertTrue(expression, format...);
XCTAssertFalse(expression, format...);
XCTAssertEqual(expression1, expression2, format...);
XCTAssertNotEqual(expression1, expression2, format...);
XCTAssertNil(expression, format...);
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active August 14, 2025 01:40
The best FRP iOS resources.

Videos

struct Regex {
let pattern: String
let options: NSRegularExpressionOptions!
private var matcher: NSRegularExpression {
return NSRegularExpression(pattern: self.pattern, options: self.options, error: nil)
}
init(pattern: String, options: NSRegularExpressionOptions = nil) {
self.pattern = pattern
protocol Calendar {
typealias Unit: BidirectionalIndexType
typealias Era: Unit
typealias Year: Unit
typealias Month: Unit
typealias Week: Unit
typealias Day: Unit
typealias Weekday: Unit
typealias Hour: Unit
@jpsim
jpsim / JAZMusician.h
Created July 7, 2014 09:25
SourceKit Playground
//
// JAZMusician.h
// JazzyApp
//
#import <Foundation/Foundation.h>
/**
JAZMusician models, you guessed it... Jazz Musicians!
From Ellington to Marsalis, this class has you covered.
@staltz
staltz / introrx.md
Last active August 15, 2025 20:30
The introduction to Reactive Programming you've been missing
@landonf
landonf / 1-XSmallTest-Usage.m
Last active August 29, 2015 14:02
A much nicer single-header XCTest-compatible testing DSL, all in a single header.
#import "XSmallTests.h"
xsm_given("an integer value") {
int v;
xsm_when("the value is 42") {
v = 42;
xsm_then("the value is the answer to the life, the universe, and everything") {
XCTAssertEqual(42, v);
}
@CodaFi
CodaFi / NUIAbstractObject.h
Created May 8, 2014 02:12
Recreating NSRequestConcreteImplementation plus a little bit more.
//
// NUIAbstractObject.h
// NUIKit
//
// Created by Robert Widmann on 5/7/14.
// Copyright (c) 2014 CodaFi. All rights reserved.
//
/// Enforces a notion of abstract methods in an Objective-C class.
///
#!/usr/bin/env zsh
branch=`git rev-parse --abbrev-ref HEAD`
git show-branch | ack '\*' | ack -v "$branch" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'
# How it works:
# 1| Display a textual history of all commits.
# 2| Ancestors of the current commit are indicated
# by a star. Filter out everything else.
@samwgoldman
samwgoldman / Maybe.h
Created March 12, 2014 22:42
Maybe monad-alike in Objective-C using parts of ReactiveCocoa and libextobjc concrete protocols
#import <Foundation/Foundation.h>
#import <libextobjc/EXTConcreteProtocol.h>
@protocol Maybe <NSObject>
- (id<Maybe>)map:(id (^)(id value))block;
- (id<Maybe>)flattenMap:(id<Maybe> (^)(id value))block;
- (id<Maybe>)orElse:(id)defaultValue;
- (id)getOrElse:(id)defaultValue;