Skip to content

Instantly share code, notes, and snippets.

View ianterrell's full-sized avatar

Ian Terrell ianterrell

  • University of Virginia
  • Charlottesville, VA
View GitHub Profile
@ianterrell
ianterrell / GenerateEquatable.swift
Last active October 13, 2016 18:36 — forked from Ben-G/GenerateEquatable.swift
Generate Equatable in terms of member fields
//: Playground - noun: a place where people can play
import UIKit
func generateEquatable(_ t: Any) -> String {
var output = ""
let mirrorPlace = Mirror(reflecting: t)
let type = mirrorPlace.subjectType
output += ("extension \(type): Equatable {\n")
@ianterrell
ianterrell / gist:1102751
Created July 24, 2011 15:49 — forked from deathbob/gist:1102683
Meta module madness
module Foo
def bar
@bar ||= self.snakes
end
end
class Baz
def self.snakes
[:cobra]