I hereby claim:
- I am simonbromberg on github.
- I am shimmyb (https://keybase.io/shimmyb) on keybase.
- I have a public key ASB34tUB3P7JuaAvVAAlIxrQLjO17d2EKOCuf0Cx5bDR8Ao
To claim this, I am signing this object:
| // List all fonts on iPhone | |
| NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]]; | |
| for (NSString *family in familyNames) { | |
| NSLog(@"Family name: %@", family); | |
| fontNames = [UIFont fontNamesForFamilyName: family]; | |
| for (NSString *font in fontNames) { | |
| NSLog(@" Font name: %@", font); | |
| } |
| extension UIGestureRecognizerState { | |
| var logString: String { | |
| switch self { | |
| case .began: | |
| return "began" | |
| case .cancelled: | |
| return "cancelled" | |
| case .changed: | |
| return "changed" | |
| case .ended: |
| extension Double { | |
| // Given a value to round and a factor to round to, | |
| // round the value to the nearest multiple of that factor. | |
| mutating func round(toNearest: Double) { | |
| self = (self / toNearest).rounded() * toNearest | |
| } | |
| // Given a value to round and a factor to round to, | |
| // round the value DOWN to the largest previous multiple | |
| // of that factor. |
I hereby claim:
To claim this, I am signing this object:
| function getId() { | |
| /** | |
| * Imported from https://github.com/kyo-ago/UUID | |
| * Robbie Mitchell, @superstrong | |
| */ | |
| /** | |
| * UUID.core.js: The minimal subset of the RFC-compliant UUID generator UUID.js. | |
| * | |
| * @fileOverview |
| func registerKeyboardNotifications() { | |
| NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil) | |
| NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillChangeFrame(_:)), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil) | |
| } | |
| @objc func keyboardWillShow(_ notification: Foundation.Notification) { | |
| guard let userInfo = notification.userInfo else { | |
| return | |
| } | |
| func registerKeyboardNotifications() { | |
| NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillChangeFrame(_:)), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil) | |
| } | |
| @objc func keyboardWillChangeFrame(_ notification: Foundation.Notification) { | |
| guard let userInfo = notification.userInfo else { | |
| return | |
| } | |
| let offset = UIScreen.main.bounds.height - (userInfo[UIKeyboardFrameEndUserInfoKey] as AnyObject).cgRectValue.minY |
| struct Heap<Element> { | |
| var elements: [Element] | |
| let priorityFunction: (Element, Element) -> Bool | |
| init(elements: [Element] = [], priorityFunction: @escaping (Element, Element) -> Bool) { | |
| self.priorityFunction = priorityFunction | |
| self.elements = [] | |
| for element in elements { | |
| enqueue(element) |
| /* | |
| Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. | |
| For example, the message '111' would give 3, since it could be decoded as 'aaa', 'ka', and 'ak'. | |
| You can assume that the messages are decodable. For example, '001' is not allowed. | |
| */ | |
| import Foundation |
| function run(input, parameters) { | |
| var myRegexp = /(\[.*\])\((.*?)\)/g; | |
| var match = myRegexp.exec(input); | |
| if (match == null || match.length <= 2) { | |
| return input | |
| } | |
| return `<img src=\"${match[2]}\" width=\"350\">` | |
| } |