Skip to content

Instantly share code, notes, and snippets.

View michaelteter's full-sized avatar

Michael Teter michaelteter

View GitHub Profile
# There are many ways to do this, but without knowing circumstantial constraints I chose simple/brute-force.
def activities_by_location(activities):
locations = {}
for k,v in activities.items():
for location in v:
if location not in locations:
locations[location] = []
locations[location].append(k)
return locations

Keybase proof

I hereby claim:

  • I am michaelteter on github.
  • I am michaelteter (https://keybase.io/michaelteter) on keybase.
  • I have a public key whose fingerprint is B1CB 5A75 8AB1 C7FE FDAC 6D50 0025 FC55 B68D 4D47

To claim this, I am signing this object:

@michaelteter
michaelteter / alamofire4_example.swift
Last active September 18, 2016 17:45
Reminder of the syntax of Alamofire 4 JSON request
// Remember to add to Info.plist
// App Transport Security Settings / Dictionary
// Allow Arbitrary Loads / Boolean / YES
// (or to be safer, use the Exception Domains subkey to be specific about which domains are allowed non-secure)
import Alamofire
// ...
func example() {
let url = URL(string: "http://pokeapi.co/api/v2/type/3/")!
@michaelteter
michaelteter / gist:442894d8ccdc9ada3cd2f2513dbf1849
Last active October 17, 2016 01:37
Xcode 8, Swift 3, and Alamofire - getting it setup and building
Alamofire has recently been updated. Now it seems to support Swift 3 from its main (master) branch.
Below are instructions that should work :)
------------------------------------------------------------------------------------------------
CURRENT INSTRUCTIONS ---------------------------------------------------------------------------
1. Install cocoapods
$ sudo gem install cocoapods
2. create an xcode project