Skip to content

Instantly share code, notes, and snippets.

View mlvea's full-sized avatar
🌴
On vacation

Phanerozoic mlvea

🌴
On vacation
View GitHub Profile
@mlvea
mlvea / currencies.json
Created March 17, 2015 16:07
Common currencies as an array
[
{
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@mlvea
mlvea / 01_functions.swift
Last active August 29, 2015 14:17
Swift Funtions
//Swift Function
func keepCalmAndLearnSwift(){
println("Ohh yeah. Learning Swift")
}
//Swift function with parameters
func keepCalmAndLearn(language: String){
println("Ohh yeah. Learing \(language)")
@mlvea
mlvea / optionals_basic.swift
Last active August 29, 2015 14:17
Optionals and Dictionary
let netWorthOfBillionaires = ["Bill Gates":78.5,"Carlos Slim Helu":71,"Warren Buffett":70.9]
let possibleNetWorth = netWorthOfBillionaires["Tim Cook"]
//Type of the possibleNetWorth is inferred to Double?
//Know what! Tim cook is not a billionair yet. His net worth is aroung $400 million
//Thats why he is not in our list. But who knows. He might becomes a billionair
if (possibleNetWorth != nil){
@mlvea
mlvea / modify_array.swift
Created March 15, 2015 02:03
Arrays in swift
//My favourite movies
var favouriteMovies = ["Inception","Theory of Everything","Fifty Shades of Grey"]
//I have new favourite
favouriteMovies += "PK"
//Ohh forgot The Hunger Games
favouriteMovies += ["Hunger Games","Catching Fire","Mocking Jay"]
//Hmm. Replace Fifty Shades and PK with new favourites I happened to watch recently -> Interstellar and The Social Network
@mlvea
mlvea / enemarate_with_index.swift
Last active August 29, 2015 14:17
Objective c array enumeration in swift
//Teams play for Cricket world cup 2015 super 8
var superEight = ["NZ","Aus","SL","Bang","Ind","SA","Pak","WI"]
for (index, value) in enumerate(superEight){
println("Team \(index+1) : \(value)")
}