Skip to content

Instantly share code, notes, and snippets.

View langford's full-sized avatar

Michael Langford langford

View GitHub Profile
let individualScores = [75, 43, 103, 87, 12]
var teamScore = 0
if 75 > 50 {
teamScore += 3 //this makes teamScore go from 0->3
} else {
teamScore += 1
}
@langford
langford / gist:7e682d04f8f9ddead708
Last active August 29, 2015 14:02
Multiple methods with same type but different method param names. Still basically objective c style.
//
// ViewController.swift
// Silverton Resource Tracker
//
// Created by Michael Langford on 6/2/14.
// Copyright (c) 2014 Rowdy Labs LLC. All rights reserved.
//
import UIKit
@langford
langford / gist:c4d4a78673cdf8d660c3
Created June 5, 2014 01:50
Random test of method overloading
import UIKit
class Square {
var sideLength: Double
init(sideLength: Double, name: String) {
self.sideLength = sideLength
}
init(sideSlipperyness: Double, name: String) {
@langford
langford / gist:8284ed5ef5d3cfc9fa5c
Last active August 29, 2015 14:02
Naive Infix Array Combiner Operator for Swift
func + <T> (left: T[], right: T[]) -> T[] {
var newArray : T[] = []
for item in left {
newArray.append(item)
}
for item in right {
newArray.append(item)
}
return newArray;
}
@langford
langford / gist:c0d0cec92017b44fc72c
Created August 10, 2014 17:31
Instead of this in cellForRowAtIndexpath
In init:
-(instancetype)init{
...
_sections = @[
@[@"Twitter",@"Blog",@"Contact Us"],
@[@"nameone",@"nametwo",@"namethree"]
];
...
@langford
langford / pp-hickory.clj
Created November 22, 2014 17:11
Raw hickory file generated from the Class Warfare book
This file has been truncated, but you can view the full file.
{:type :document,
:content
[{:type :document-type,
:attrs
{:name "html",
:publicid "-//W3C//DTD XHTML 1.0 Transitional//EN",
:systemid
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"}}
{:type :element,
:attrs {:xmlns "http://www.w3.org/1999/xhtml"},
@langford
langford / gist:8c2e3d4e40c423bf4cb2
Created December 13, 2014 02:06
Good Mac Software
https://itunes.apple.com/us/app/numbers/id409203825?mt=12 It's like excel but free and from apple
https://www.apple.com/mac/keynote/ arguably better than powerpoint in almost every way
https://itunes.apple.com/us/app/alfred/id405843582?mt=12 Alfred (Makes launching apps easy)
https://itunes.apple.com/us/app/transmit/id403388562?mt=12 Makes copying files to internet sites easy
https://itunes.apple.com/us/app/mail-notifr/id808154494?mt=12 Makes "mail to" web browser sites work with gmail
@langford
langford / gist:68b86eb3ee274f426f35
Created January 30, 2015 20:03
Doing IPA builds from the command line because you're tired of the lack of repeatability in Xcode Adhoc builds
#!/bin/sh
# Current as working as of 2014/09/22
# modified form of http://stackoverflow.com/questions/25056144/xcode-6-how-to-pick-signing-certificate-provisioning-profile-for-ad-hoc-distri
# Xcode 6
MYAPP="HELLOWORLD"
OUTPUTDIR="$HOME/Desktop/$MYAPP"
APPNAME="ANAppName"
SCHEME="ASchemeName"
@langford
langford / gist:70c9c8c735eae310ef8d
Created February 5, 2015 17:48
Build production, passing "FORCE_PROD" environment variable (which I pass to the preprocessor in my build scheme)
#!/bin/sh
OUTPUTDIR="$HOME/Desktop/The_App"
APPNAME="The_App"
SCHEME="The_App"
SRCROOT=`pwd`
APP_WORKSPACE="$SRCROOT/The_App.xcworkspace"
ARCHIVE_PATH="$OUTPUTDIR/$APPNAME-production.xcarchive"
rm -f "$OUTPUTDIR/$APPNAME-production.ipa"
import AddressBook
import UIKit
typealias CThingPtr = UnsafeMutablePointer <ABRecordRef>
func cthing_dispose(o:CThingPtr?)->(){
}
func cthing_create(cString:UnsafePointer<Int8>)->CThingPtr{
return nil