Skip to content

Instantly share code, notes, and snippets.

@sheafk
sheafk / Example of Pod Update
Created September 23, 2016 15:23
Example of a Pod Update
[11:19:33] (master) LuckTracker
// ♥ pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Using BFPaperButton (2.1.1)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 1 total
var dummyDictionaryLocationQuotient = ["District of Columbia" : 1.81,
"Colorado" : 1.55,
"Delaware" : 1.44,
"New York" : 1.27,
"Virginia" : 1.21,
"Maryland" : 1.18,
"South Dakota" : 1.18,
"Massachusetts" : 1.16,
"Texas" : 1.14,
"Minnesota" : 1.08,
func setLocationQuotientMap(dictionary: [String : Double]) {
self.usaColorMapView.backgroundColor = UIColor.clearColor()
self.usaColorMapView.setColorForAllStates(UIColor.flatGrayColor())
self.usaColorMapView.performUpdates {
for (state, locationQuotient) in dictionary {
switch locationQuotient {
/Users/flatironschool/.ssh
[15:01:23] .ssh
// ♥ ssh-add -D
All identities removed.
[15:01:53] .ssh
// ♥ ssh git@github.com
Permission denied (publickey).
[15:01:57] .ssh
// ♥ ssh-keygen
Generating public/private rsa key pair.
//Codes and Descriptions from http://www.bls.gov/oes/current/oes_stru.htm#15-0000
// code : [description, second_button code]
let careerOpTwoDictExpress: Dictionary = [
21-0000 : ["Community and Social Service Occupations", "Health"],
25-1060 : ["Social Sciences Teachers, Postsecondary", "Teaching"],
25-2000 : ["Preschool, Primary, Secondary, and Special Education School Teachers", "Teaching"],
27-1010 : ["Designers", "Art"],
27-2000 : ["Entertainers and Performers, Sports and Related Workers", "Sports"],
@sheafk
sheafk / Contains String: Search by Keyword
Created August 5, 2016 13:07
An example of searching by Keyword
//Search by Keyword
let savedApartments = [
"apt1" : "The unit comes with stainless steel appliances, a full-sized refrigerator, plenty of storage, a gas oven, a gas range, and a dishwasher.The bedroom has hardwood floors and a window that opens.", "apt2" : "you will love it", "apt3" : "So many great amenities"]
for (name, description) in savedApartments {
if description.containsString("a window that opens") {
print(name)
}
}
@sheafk
sheafk / Filter by Keyword
Created August 5, 2016 13:01
Example of filtering by key word
//Select nonchanging values like neighbordhoods - Good for buttons
let neighborhoods: NSArray = ["Crown Heights", "Clinton Hill", "Sunset Park"]
let fiteredNeighborhoods = (neighborhoods as! Array).filter { $0 == "Sunset Park" }
print(fiteredNeighborhoods)
@sheafk
sheafk / Greater Than or Less Than
Created August 5, 2016 12:43
Example of using the filter function
//Greater Than or Less Than
var rentPerMonth = [["rent" : 2200], ["rent" : 2350], ["rent" : 2300], ["rent" : 2490]]
var filteredRent = rentPerMonth.filter({
$0["rent"] < 2000
})
print(filteredRent)
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
if let touch = touches.first {
let position = touch.locationInView(view)
print(position)
}
}