Skip to content

Instantly share code, notes, and snippets.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
@ktustanowski
ktustanowski / decrypting_gravity_falls.swift
Created August 4, 2017 19:27
Decrypting Gravity Falls
class Decryptor {
fileprivate var alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
func decrypt(_ input: String) -> String? {
var output = ""
for character in input.characters {
output += substitute(String(character).lowercased())
}
return output
DurationReporter.onReportEnd = { _, _ in
print(DurationReporter.generateReport())
}
print(DurationReporter.generateReport())
/*
User taps play
*/
DurationReporter.begin(event: "Video", action: "Buffering")
/*
Playback starts
*/
DurationReporter.end(event: "Video", action: "Buffering")
let collectedData = DurationReporter.reportData()
/*
Send report to analytics with use of 🚀 & 🎉
*/
DurationReporter.clear()
DurationReporter.begin(event: "Application Start", action: "Loading", payload: "🚀")
/* some flow */
DurationReporter.end(event: "Application Start", action: "Loading", payload: "🎉")
DurationReporter.onReportEnd = { eventName, report in
guard let beginPayload = report.beginPayload as? String,
let endPayload = report.endPayload as? String else { return }
/*
Send report to analytics with use of 🚀 & 🎉
*/
DurationReporter.onReportEnd = { eventName, report in
/*
Send report to analytics
*/
}
/* Application Delegate */
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
DurationReporter.begin(event: "ApplicationStart", action: "Initial Processing")
/*
Some processing
*/
DurationReporter.end(event: "ApplicationStart", action: "Initial Processing")
DurationReporter.begin(event: "Application Start", action: "Showing of Home")
return true
}
/* Application Delegate */
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
DurationReporter.begin(event: "ApplicationStart", action: "Initial Processing")
/*
Some processing
*/
DurationReporter.end(event: "ApplicationStart", action: "Initial Processing")
return true
}