Skip to content

Instantly share code, notes, and snippets.

View elm4ward's full-sized avatar

Elmar Kretzer elm4ward

View GitHub Profile
@sjoerdvisscher
sjoerdvisscher / expression-problem.swift
Last active August 21, 2019 16:57
Finally tagless in Swift 3
protocol Expr {
static func lit(_ x: Int) -> Self
static func add(_ lhs: Self, _ rhs: Self) -> Self
}
extension Int : Expr {
static func lit(_ x : Int) -> Int {
return x;
}
static func add(_ lhs: Int, _ rhs: Int) -> Int {
@nevyn
nevyn / NSObject+SPInvocationGrabbing.h
Created August 6, 2010 11:14
Spotify's invocation grabber, with some magic tricks
#import <Foundation/Foundation.h>
@interface SPInvocationGrabber : NSObject {
id _object;
NSInvocation *_invocation;
int frameCount;
char **frameStrings;
BOOL backgroundAfterForward;
BOOL onMainAfterForward;
BOOL waitUntilDone;