(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| ;; This is at: https://gist.github.com/8655399 | |
| ;; So we want a rhyming dictionary in Clojure. Jack Rusher put up | |
| ;; this code here: | |
| ;; | |
| ;; https://gist.github.com/jackrusher/8640437 | |
| ;; | |
| ;; I'm going to study this code and learn as I go. | |
| ;; | |
| ;; First I put it in a namespace. |
| #ifndef NS_DESIGNATED_INITIALIZER | |
| #if __has_attribute(objc_designated_initializer) | |
| #define NS_DESIGNATED_INITIALIZER __attribute((objc_designated_initializer)) | |
| #else | |
| #define NS_DESIGNATED_INITIALIZER | |
| #endif | |
| #endif |
| // | |
| // NSImage+Retina.h | |
| // | |
| // Created by Levi Nunnink on 3/11/14. | |
| // | |
| #import <Cocoa/Cocoa.h> | |
| @interface NSImage (Retina) |
| - (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard { | |
| // pasteboard must be stored away because there's no way to get it in -pasteboardPropertyListForType: :( | |
| _currentPasteboard = pasteboard; | |
| NSArray *types = @[(id)kPasteboardTypeFileURLPromise, (id)kPasteboardTypeFilePromiseContent]; | |
| return types; | |
| } | |
| // ... |
| // | |
| // Swift-KVO | |
| // | |
| // Created by Jim Correia on 6/5/14. | |
| // Copyright (c) 2014-2015 Jim Correia. All rights reserved. | |
| // | |
| // Update: 6/17/2014 | |
| // | |
| // KVOContext has gone away; use the same idiom you'd use from Objective-C for the context | |
| // |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // You might think that a view could trigger window movement by overriding -[NSView mouseDownCanMoveWindow] | |
| @interface DraggyView : NSView | |
| @end | |
| @implementation DraggyView | |
| - (BOOL)mouseDownCanMoveWindow { | |
| return YES; | |
| } | |
| @end |
| # | |
| # Set the build number to the current git commit count. | |
| # If we're using the Dev scheme, then we'll suffix the build | |
| # number with the current branch name, to make collisions | |
| # far less likely across feature branches. | |
| # Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/ | |
| # | |
| git=`sh /etc/profile; which git` | |
| appBuild=`"$git" rev-list --all |wc -l` | |
| if [ $CONFIGURATION = "Debug" ]; then |
| # Set the build number to the current git commit count. | |
| # | |
| # Permanent home: | |
| # https://gist.github.com/jaredsinclair/af6898f93674ee5923f3 | |
| # | |
| # Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/ | |
| # Updated with dSYM handling from http://yellowfeather.co.uk/blog/auto-incrementing-build-number-in-xcode-revisited/ | |
| git=`sh /etc/profile; which git` | |
| appBuild=`"$git" rev-list HEAD --count` |
| // | |
| // CollectionViewDataSource.swift | |
| // Khan Academy | |
| // | |
| // Created by Andy Matuschak on 10/14/14. | |
| // Copyright (c) 2014 Khan Academy. All rights reserved. | |
| // | |
| import UIKit |