Skip to content

Instantly share code, notes, and snippets.

View cruffenach's full-sized avatar

Collin Ruffenach cruffenach

View GitHub Profile
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 20 columns, instead of 13. in line 4.
year,week,away_division_id,away_division_name,away_owners,away_team_abbrev,away_team_id,away_team_name,away_score,away_owner_name,home_division_id,home_division_name,home_owners,home_team_abbrev,home_team_id,home_team_name,home_score,home_owner_name,is_playoff,matchup_type
2012,1,0,Stark,{E4D517A5-003A-4BED-B0AD-C112CF953C58},WILS,1,The Revolution,145.1,Robb Wilson,0,Stark,{0FCB80AA-989F-4363-A860-69112E955D50},FML,8,My Bench is Blowing Up,137.12,FJ Pfitzer,false,NONE
2012,1,1,Baratheon,{7DCF1066-87D9-4987-BDD7-A9EA511E53DB},NICH,3,Showerin With Sandusky,100.02,Tanner Nicholson,1,Baratheon,{C417A672-B1F6-4098-AF88-4DC79D69C96D},KIDZ,6,Team Lines,95.52,Brian Lines,false,NONE
2012,1,2,Targaryen,{6D143E84-3D31-4ACC-98CD-4F72E1CD8B4E},RUFF,4,The Ron Fucking Swansons,101.86,Stephen Ruffenach,2,Targaryen,{C85A9FF9-8C7B-4A78-A078-D795B6B72A60},CRUF,12,Spike The Mic,92.54,Collin Ruffenach,false,NONE
2012,1,0,Stark,{D5E92792-3EC2-4B71-B7B8-5A862C2AF11C},RIDG,7,GriffinDor III,95.78,Adam Ridgeway,0,Stark,{0B73CD43-F23C
@cruffenach
cruffenach / Prep.swift
Created November 6, 2014 21:27
Interview Prep
// Playground - noun: a place where people can play
import Foundation
import UIKit
//struct Square {
// var x, y, width, height : Float
//}
//
//func overlap(start1 : Float, length1 : Float, start2 : Float, length2 : Float) -> Float {
@cruffenach
cruffenach / gist:0d8e53475f0e4bd018e0
Created October 25, 2014 22:39
Single Linked List Node
class SingleLinkedListNode <T : Printable> : Printable {
var next : LinkedListNode?
var data : T
init(data : T) {
self.data = data
}
var description : String {
get {
void CRWaitMinimumDurationAndExecute(NSTimeInterval start, NSTimeInterval minimumDuration, void(^block)(void)) {
double diff = [NSDate date].timeIntervalSince1970-start;
double delayInSeconds = MAX(0.0, minimumDuration-diff);
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
if (block) block();
});
}
//Usage
struct CGRaw {
static func rawRect(#uiKitRect : CGRect) -> CGRect {
let scale = UIScreen.mainScreen().scale
return CGRect(
x: CGRectGetMinX(uiKitRect)*scale,
y: CGRectGetMinY(uiKitRect)*scale,
width: CGRectGetWidth(uiKitRect)*scale,
height: CGRectGetHeight(uiKitRect)*scale
)
@cruffenach
cruffenach / gist:0e98947402b18faea48e
Last active August 29, 2015 14:06
AnimationType enum with Associated Values
enum AnimationType : Printable {
case Linear(duration : NSTimeInterval?)
case Spring(damping : CGFloat?, velocity : CGFloat?, duration : NSTimeInterval?)
case Gravity(magnitude : CGFloat?)
}
@cruffenach
cruffenach / gist:3ed23d6d80ed27fd6928
Created August 29, 2014 20:38
Index in Array's map and reduce
extension Array {
func map<U>(function : (index : Int, object : T) -> U) -> [U] {
var result = [U]()
for i in 0..<self.count {
result.append(function(index: i, object: self[i]))
}
return result
}
func reduce<U>(initial : U, combine : (product : U, index : Int, object : T) -> U) -> U {
//
// LogoPathFactory.swift
// LogoFunhouse_Swift
//
// Created by Collin Ruffenach on 8/25/14.
// Copyright (c) 2014 Simple. All rights reserved.
//
import Foundation
import UIKit
@cruffenach
cruffenach / gist:45a98ce6f2a49b5e859b
Last active June 30, 2018 13:23
Guilloche Drawing in Playgrounds
// Playground - noun: a place where people can play
import Cocoa
import QuartzCore
import XCPlayground
import Accelerate
func showMessage(message : String, messageIndex: Integer) {
let attributedString = NSAttributedString(string: message, attributes: NSDictionary(object: NSFont(name: "HelveticaNeue-Light", size: 24), forKey: NSFontAttributeName))
XCPCaptureValue("Message \(messageIndex)", attributedString)
@cruffenach
cruffenach / gist:3de3b6225030c957f99a
Created June 3, 2014 20:27
Swift String Length Extension
extension String {
var length : Integer {
get {
return countElements(self)
}
}
}