This file contains hidden or 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
| // | |
| // PrettyScore.swift | |
| // | |
| // Created by Ashton Meuser on 2017-07-21. | |
| // Copyright © 2017 Ashton Meuser. All rights reserved. | |
| // | |
| import Foundation | |
| extension Double { |
This file contains hidden or 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
| // | |
| // ColorIsLight.swift | |
| // | |
| // Created by Ashton Meuser on 2017-04-26. | |
| // Copyright © 2017 Ashton Meuser. All rights reserved. | |
| // | |
| import Foundation | |
| import UIKit |
This file contains hidden or 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
| // | |
| // UUIDv1.swift | |
| // | |
| // Created by Ashton Meuser on 2017-07-04. | |
| // Copyright © 2017 Ashton Meuser. All rights reserved. | |
| // | |
| import Foundation | |
| extension UUID { |
This file contains hidden or 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
| // | |
| // DateTimePassed.swift | |
| // | |
| // Created by Ashton Meuser on 2017-08-21. | |
| // Copyright © 2017 Ashton Meuser. All rights reserved. | |
| // | |
| import Foundation | |
| extension Date { |
This file contains hidden or 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
| // | |
| // MulticastDelegate.swift | |
| // | |
| // Created by Ashton Meuser on 2017-11-06. | |
| // Copyright © 2017 Ashton Meuser. All rights reserved. | |
| // | |
| // Delegate property: var multicastDelegate = MulticastDelegate<MyDelegateProtocol>() | |
| // Assign a delegate: multicastDelegate += self | |
| // Invoke delegate methods: multicastDelegate.invoke { $0.protocolMethod() } |
This file contains hidden or 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
| // | |
| // DarkColorFromHash.swift | |
| // | |
| // Created by Ashton Meuser on 2017-04-26. | |
| // Copyright © 2017 Ashton Meuser. All rights reserved. | |
| // | |
| import Foundation | |
| import UIKit |
This file contains hidden or 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
| // | |
| // CircleView.swift | |
| // | |
| // Created by Ashton Meuser on 2017-11-08. | |
| // Copyright © 2017 Ashton Meuser. All rights reserved. | |
| // | |
| import UIKit | |
| class CircleView: UIView { |
This file contains hidden or 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
| const exponentialPrefix = (value, fixed = 0, unit = '') => { | |
| const prefixes = ['y', 'z', 'a', 'f', 'p', 'n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; | |
| const expString = value.toExponential(); | |
| const [sig, exp] = expString.split('e').map(Number); | |
| const engr = Math.floor(exp / 3) * 3; | |
| const base = (sig * (10 ** (exp - engr))).toFixed(fixed); | |
| const prefix = prefixes[(engr / 3) + 8]; | |
| if (typeof prefix === 'undefined') { | |
| return `${sig.toFixed(fixed)}e${exp}${unit}`; | |
| } |
This file contains hidden or 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
| const crypto = require('crypto'); | |
| const encryptionSecret = Buffer.from(process.env.ENCRYPTION_SECRET); | |
| const encrypt = (string) => { | |
| const iv = crypto.randomBytes(16); | |
| const cipher = crypto.createCipheriv('aes-256-cbc', encryptionSecret, iv); | |
| let encrypted = cipher.update(string); | |
| encrypted = Buffer.concat([encrypted, cipher.final()]); |
This file contains hidden or 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
| // Lambda helper class | |
| final class LambdaHelper { | |
| // AWS config constants, etc. | |
| private let lambdaInvoker: AWSLambdaInvoker! | |
| static let sharedInstance = LambdaHelper() | |
| private init() { | |
| // Set up AWS config, etc. | |
| lambdaInvoker = AWSLambdaInvoker.default() | |
| } |
OlderNewer