Skip to content

Instantly share code, notes, and snippets.


A Wild Austin Feight feighter09

View GitHub Profile
miguelcma / DeviceUID.m
Created May 25, 2015
iOS Unique Device ID that persists between app reinstalls
View DeviceUID.m
/* DeviceUID.h
#import <Foundation/Foundation.h>
@interface DeviceUID : NSObject
+ (NSString *)uid;
// Device.m
JadenGeller / List Comprehension.swift
Last active Mar 17, 2018
Nondeterministic Computation with Arrays
View List Comprehension.swift
// In languages like Python and Haskell, we can write list comprehension syntax like
// super simply to generate complex lists. Below, for example, we find all numbers that are
// the product of two sides of a triangle.
// [a * b | a <- [1..10], b <- [1..10], c <- [1..10], a * a + b * b == c * c]
// Why is this called nondeterministic computation? Because we essentially try ALL possible combinations
// of these values (a,b) and--you can imagine--run them all simultanously and get the result that matches the predicate.
// Now, obviously, this doesn't all happen at the same time, but that's the idea behind the nondeterminism.
// Let's examine how we can get a similiar result in Swift! We'll start super simple and work
natecook1000 / shuffle.swift
Last active Dec 11, 2018
Shuffle/shuffled functions & Array extensions
View shuffle.swift
// (c) 2014 Nate Cook, licensed under the MIT license
// Fisher-Yates shuffle as top-level functions and array extension methods
/// Shuffle the elements of `list`.
func shuffle<C: MutableCollectionType where C.Index == Int>(inout list: C) {
let c = count(list)
for i in 0..<(c - 1) {
let j = Int(arc4random_uniform(UInt32(c - i))) + i
swap(&list[i], &list[j])
simonmichael / gist:1185421
Created Sep 1, 2011
ghc-pkg-clean, ghc-pkg-reset
View gist:1185421
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
echo unregistering $p; ghc-pkg $* unregister $p
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
You can’t perform that action at this time.