This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func reverseString(inout string: String) { | |
var chars = Array(string.characters) | |
var temp: Character! | |
for i in 0..<chars.count/2 { | |
temp = chars[i] | |
chars[i] = chars[chars.count - (i + 1)] | |
chars[chars.count - (i + 1)] = temp | |
} | |
string = chars.reduce("") {$0 + "\($1)"} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>DVTConsoleDebuggerInputTextColor</key> | |
<string>1 1 1 1</string> | |
<key>DVTConsoleDebuggerInputTextFont</key> | |
<string>Menlo-Bold - 11.0</string> | |
<key>DVTConsoleDebuggerOutputTextColor</key> | |
<string>1 1 1 1</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sameCharacters(string stringOne: String, string stringTwo: String) -> Bool { | |
let stringOneCharacters = stringOne.characters | |
let stringTwoCharacters = stringTwo.characters | |
// Early exit 1 | |
if stringOneCharacters.count != stringTwoCharacters.count { | |
return false | |
} | |
var charMatched = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// FitBitClient | |
// | |
// Created by Miguel Fermin on 1/17/16. | |
// Copyright © 2016 MAF Software, LLC. All rights reserved. | |
// | |
import UIKit | |
import SafariServices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift Functional Programming: Reduce | |
// | |
// By Miguel Fermin on 2016.01.28 | |
// | |
// Reference: http://www.raywenderlich.com/82599/swift-functional-programming-tutorial | |
import UIKit | |
// Manual Reduction: | |
// Take the even numbers between 1 and 10 and compute their sum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift Functional Programming: Map | |
// | |
// By Miguel Fermin on 2016.01.28 | |
// | |
// Reference: https://www.weheartswift.com/higher-order-functions-map-filter-reduce-and-more/ | |
import UIKit | |
// The map method solves the problem of transforming the elements of an array using a function. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift Functional Programming: Filters | |
// | |
// By Miguel Fermin on 2016.01.27 | |
// | |
// Reference: http://www.raywenderlich.com/82599/swift-functional-programming-tutorial | |
import Cocoa | |
/* Find all the even numbers between 1 and 10 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
/* Sieve of Eratosthenes Algorithms | |
* | |
* In mathematics, the sieve of Eratosthenes one of a number of prime number sieves, is a simple, ancient algorithm | |
* for finding all prime numbers up to any given limit. | |
* | |
* Pseudocode to find all the prime numbers less than or equal to a given integer n by Eratosthenes' method: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MAFSegueHandlerType.swift | |
// MAFFinance | |
// | |
// Created by Miguel Fermin on 8/1/15. | |
// Copyright © 2015 Miguel Fermin. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MAFStoryBoardHandlerType.swift | |
// MAFFinance | |
// | |
// Created by Miguel Fermin on 10/20/15. | |
// Copyright © 2015 MAF Software LLC. All rights reserved. | |
// | |
import UIKit |
OlderNewer