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
@IBAction func showActionSheet(sender: AnyObject) { | |
// 1 | |
let optionMenu = UIAlertController(title: nil, message: "Choose Option", preferredStyle: .ActionSheet) | |
// 2 | |
let deleteAction = UIAlertAction(title: "Delete", style: .Default, handler: { | |
(alert: UIAlertAction!) -> Void in | |
println("File Deleted") | |
}) | |
let saveAction = UIAlertAction(title: "Save", style: .Default, handler: { |
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
function writeDataToFirebase() { | |
var ss = SpreadsheetApp.openByUrl(<insert spreadsheet url>); | |
var sheet = ss.getSheets()[0]; | |
var data = sheet.getDataRange().getValues(); | |
var dataToImport = {}; | |
for(var i = 1; i < data.length; i++) { | |
//prepare the key and grab the data key and values | |
var emailAddress = data[i][1]; | |
var lessonCompleted = data[i][2]; | |
dataToImport[Utilities.base64Encode(emailAddress) + "-" + lessonCompleted] = { |
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
// MARK: - is palindrome permutation | |
func ispalindrome(line: String) -> Bool { | |
var counter: [Character : Int] = [:] | |
for character in line where character != " " { | |
if let count = counter[character] { | |
counter[character] = count + 1 | |
} else { | |
counter[character] = 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
// MARK: - is palindrome permutation | |
func ispalindrome(line: String) -> Bool { | |
var counter: [Character : Int] = [:] | |
for character in line where character != " " { | |
if let count = counter[character] { | |
counter[character] = count + 1 | |
} else { | |
counter[character] = 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
// MARK: - is palindrome permutation | |
func ispalindrome(line: String) -> Bool { | |
var counter: [Character : Int] = [:] | |
for character in line where character != " " { | |
if let count = counter[character] { | |
counter[character] = count + 1 | |
} else { | |
counter[character] = 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
import Foundation | |
protocol DataProtocol { | |
init?(_ s: String) | |
} | |
extension Int : DataProtocol {} | |
extension Double : DataProtocol {} | |
extension Substring : DataProtocol {} |
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
#!/bin/bash | |
if [ "$#" -ne 2 ]; then | |
echo "Illegal number of parameters" | |
echo "re-run-code-jam.sh <exercise#> <input_file_name>" | |
exit | |
fi | |
folder=exercise$1 | |
cp *.swift $folder | |
cd $folder | |
swiftc *.swift -o solution |
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
extension UIColor { | |
@nonobjc class var jenColor: UIColor { | |
return #colorLiteral(red: 1, green: 0.6370000243, blue: 0.3889999986, alpha: 1) | |
} | |
@nonobjc class var viewBackgroundColor: UIColor { | |
return #colorLiteral(red: 0.2899999917, green: 1, blue: 1, alpha: 1) | |
} | |
@nonobjc class var randomColor: UIColor { |