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
| import UIKit | |
| class CollectionCell: UICollectionViewCell { | |
| static let reuseIdentifier = "CollectionCell" | |
| var card: UIView! | |
| var label: UILabel! | |
| var isInstalled = false | |
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
| import UIKit | |
| extension UIStackView { | |
| func removeAllArrangedSubviews() { | |
| let removedSubviews = arrangedSubviews.reduce([]) { (allSubviews, subview) -> [UIView] in | |
| self.removeArrangedSubview(subview) | |
| return allSubviews + [subview] | |
| } |
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 buffer = require('buffer'); | |
| const crypto = require('crypto'); | |
| // Demo implementation of using `aes-256-gcm` with node.js's `crypto` lib. | |
| const aes256gcm = (key) => { | |
| const ALGO = 'aes-256-gcm'; | |
| // encrypt returns base64-encoded ciphertext | |
| const encrypt = (str) => { | |
| // The `iv` for a given key must be globally unique to prevent |
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
| import Foundation | |
| import UIKit | |
| /// Used to create a layout guide that pins to the top of the keyboard | |
| final class KeyboardLayoutGuide { | |
| private let notificationCenter: NotificationCenter | |
| private let bottomConstraint: NSLayoutConstraint | |
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
| fileprivate func directoryExistsAtPath(_ path: String) -> Bool { | |
| var isDirectory = ObjCBool(true) | |
| let exists = FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory) | |
| return exists && isDirectory.boolValue | |
| } |
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
| <?php | |
| // Migration file | |
| // database\migrations\create_users_table.php | |
| use Illuminate\Support\Facades\Schema; | |
| use Illuminate\Database\Schema\Blueprint; | |
| use Illuminate\Database\Migrations\Migration; | |
| class CreateUsersTable extends Migration | |
| { |
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
| <?php | |
| require_once 'vendor/autoload.php'; | |
| use Jose\Factory\JWKFactory; | |
| use Jose\Factory\JWSFactory; | |
| $key_file = 'key.p8'; | |
| $secret = null; // If the key is encrypted, the secret must be set in this variable | |
| $private_key = JWKFactory::createFromKeyFile($key_file, $secret, [ |
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
| // | |
| // UICollectionView+ScrollViewAnimateable.swift | |
| // persimmon | |
| // | |
| // Created by Keith Norman on 5/24/16. | |
| // Copyright © 2016 Good Eggs. All rights reserved. | |
| // | |
| /// Based on https://github.com/plancalculus/MOScrollView. This allows animating contentOffset with a timing function. It's not possible to animate contentOffset via a CAAnimation. It is possible to animate bounds but then scrollview delegate methods don't get called which may be an issue if the animation exposes new cells in a table view or collection view and you expect those cells to render when the scroll into view. |
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
| import Foundation | |
| /// Find first differing character between two strings | |
| /// | |
| /// :param: s1 First String | |
| /// :param: s2 Second String | |
| /// | |
| /// :returns: .DifferenceAtIndex(i) or .NoDifference | |
| public func firstDifferenceBetweenStrings(s1: NSString, s2: NSString) -> FirstDifferenceResult { |