Skip to content

Instantly share code, notes, and snippets.

View AndrewSB's full-sized avatar

Andrew Breckenridge AndrewSB

View GitHub Profile
@AndrewSB
AndrewSB / AutoCodable.stencil
Created November 24, 2017 01:02
An Autocodable template, similar to the one @khanlou wrote about
{% for type in types.implementing.AutoCodable %}
public extension {{type.name}} {
var encodable{{type.name}}: Encodable{{ type.name }} {
return Encodable{{ type.name }}(object: self)
}
}
open class Encodable{{ type.name }}: NSObject, NSCoding {
public let object: {{ type.name }}!
@AndrewSB
AndrewSB / complicated-thrift-install.sh
Created October 24, 2017 03:40
Allows a copy-pasteable installation of thrift patched to support swift
# Read this, and then copy paste it into your shell. IF ALL of it succeeds, then you should have a usable thrift tool in /usr/local/Cellar/thrift/mine/bin/thrift
brew install thrift bison
cd /tmp
mkdir setting-up-thrift
cd setting-up-thrift
git clone https://github.com/apocolipse/thrift
cd thrift
[\s\S]*((Copyright © 2016 Andrew Breckenridge. All rights reserved)\.\n\/\/\n*)
// Assuming you have a class called API for all your API stuff
extension API {
enum PaidStatus: String {
case Paid
case Scheduled
}
}
if let paidStatus = API.PaidStatus(rawValue: paystubData.status.capitilzedString) {
switch paidStatus {
@AndrewSB
AndrewSB / treehacks.com-mobile-fix
Created November 8, 2014 07:48
Hey Treehacks, add this CSS media query to your css file to fix the responsiveness on mobile
@media only screen and (min-width : 455px) {
.organized-by .bases_logo {
width: 140px;
}
.organized-by .hackstanford_logo {
width: 180px;
}
.logo-wrapper {
width: 340px;  
}

Keybase proof

I hereby claim:

  • I am andrewsb on github.
  • I am andrewsb (https://keybase.io/andrewsb) on keybase.
  • I have a public key whose fingerprint is B030 9994 7A85 97BB 7177 B736 1D1B A287 7EE5 EDFF

To claim this, I am signing this object:

NSArray Student(user, pass)
{
Access Zangle website
if (loggedIn)
{
Access student data
Create object array of type NSArray
Transfer from local variable into NSArray
Return NSArray
}