Function | Shortcut |
---|---|
New Tab | ⌘ + T |
Close Tab or Window | ⌘ + W (same as many mac apps) |
Go to Tab | ⌘ + Number Key (ie: ⌘2 is 2nd tab) |
Go to Split Pane by Direction | ⌘ + Option + Arrow Key |
Cycle iTerm Windows | ⌘ + backtick (true of all mac apps and works with desktops/mission control) |
class EventEmitter | |
/// Shared Instance. | |
public static var sharedInstance = EventEmitter() | |
// ReactNativeEventEmitter is instantiated by React Native with the bridge. | |
private static var eventEmitter: ReactNativeEventEmitter! | |
private init() {} |
State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?
There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.
Here I present a composable pattern for pure state machiness with effects,
func sumOf(numbers: Int...) -> Int { | |
var sum = 0 | |
for number in numbers { | |
sum += number | |
} | |
return sum | |
} | |
sumOf() | |
sumOf(42, 597, 12)” |
import CoreData | |
extension NSManagedObjectContext { | |
/// Commit unsaved changes and propagate them to ancestor contexts, if any. | |
/// | |
/// :param: error A pointer to an NSError object returned on failure | |
/// :returns: true if the operation succeeds, false otherwise | |
@objc(kdj_saveToPersistentStore:) | |
public func saveToPersistentStore(error: NSErrorPointer) -> Bool { | |
if !self.save(error) { |
import Foundation | |
/// Return date that is exactly one year earlier than specified date | |
/// | |
/// :param: date NSDate | |
/// :returns: NSDate that is one year before date | |
func oneYearBeforeDate(date: NSDate) -> NSDate { | |
let offsetComponents = NSDateComponents() | |
offsetComponents.year = -1 | |
private static void setDefaultListSelector(ListView listView, Context context) { | |
TypedArray typedArray = context.obtainStyledAttributes(null, new int[]{android.R.attr.listSelector}, android.R.attr.listViewStyle, 0); | |
Drawable drawable = typedArray.getDrawable(0); | |
listView.setSelector(drawable); | |
} |
// | |
// NSData+AESCrypt.h | |
// | |
// AES Encrypt/Decrypt | |
// Created by Jim Dovey and 'Jean' | |
// See http://iphonedevelopment.blogspot.com/2009/02/strong-encryption-for-cocoa-cocoa-touch.html | |
// | |
// BASE64 Encoding/Decoding | |
// Copyright (c) 2001 Kyle Hammond. All rights reserved. | |
// Original development by Dave Winer. |