This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.
— Erik
- (UIViewController *)topViewController{ | |
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; | |
} | |
- (UIViewController *)topViewController:(UIViewController *)rootViewController | |
{ | |
if (rootViewController.presentedViewController == nil) { | |
return rootViewController; | |
} | |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
/** | |
Creates a dictionary with an optional | |
entry for every element in an array. | |
*/ | |
func toDictionary<E, K, V>( | |
array: [E], | |
transformer: (element: E) -> (key: K, value: V)?) | |
-> Dictionary<K, V> | |
{ | |
return array.reduce([:]) { |
func debounce( delay:NSTimeInterval, #queue:dispatch_queue_t, action: (()->()) ) -> ()->() { | |
var lastFireTime:dispatch_time_t = 0 | |
let dispatchDelay = Int64(delay * Double(NSEC_PER_SEC)) | |
return { | |
lastFireTime = dispatch_time(DISPATCH_TIME_NOW,0) | |
dispatch_after( | |
dispatch_time( | |
DISPATCH_TIME_NOW, |
import UIKit | |
extension UIViewController { | |
func setScreeName(name: String) { | |
self.title = name | |
self.sendScreenView() | |
} | |
extension NSTimer { | |
/** | |
Creates and schedules a one-time `NSTimer` instance. | |
- Parameters: | |
- delay: The delay before execution. | |
- handler: A closure to execute after `delay`. | |
- Returns: The newly-created `NSTimer` instance. | |
*/ |
// | |
// Badge.swift | |
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem. | |
// | |
// Usage: | |
// let label = UILabel(badgeText: "Rounded Label"); | |
// let button = UIButton(type: .System); button.rounded = true | |
// let barButton = UIBarButtonItem(badge: "42", title: "How Many Roads", target: self, action: "answer") | |
// | |
// Created by Yonat Sharon on 06.04.2015. |
class BackgroundTask { | |
private let application: UIApplication | |
private var identifier = UIBackgroundTaskInvalid | |
init(application: UIApplication) { | |
self.application = application | |
} | |
class func run(application: UIApplication, handler: (BackgroundTask) -> ()) { | |
// NOTE: The handler must call end() when it is done |
// GSON can parse the data. | |
// | |
// Deserialization: | |
// Note there is a bug in GSON 2.3.1 that can cause it to StackOverflow when working with RealmObjects. | |
// To work around this, use the ExclusionStrategy below or downgrade to 1.7.1 | |
// See more here: https://code.google.com/p/google-gson/issues/detail?id=440 | |
// | |
// Serialization: | |
// <Type>RealmProxy objects are created by the Realm annotation processor. They are used to control | |
// access to the actual data instead of storing them in fields and it is therefore them we need to register a |