(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.
protocol Castable {} | |
protocol UnsafePointerProtocol: NilLiteralConvertible { | |
associatedtype Memory | |
init(nilLiteral: ()) | |
init<Memory>(_ from: UnsafeMutablePointer<Memory>) | |
init<Memory>(_ from: UnsafePointer<Memory>) | |
var memory: Memory { get } | |
func mutable<M>() -> UnsafeMutablePointer<M> |
private class Block<T> { | |
let f : T | |
init (_ f: T) { self.f = f } | |
} | |
extension NSTimer { | |
static func xxx_scheduledTimerWithTimeInterval(ti: NSTimeInterval, block: ()->(), repeats: Bool) -> NSTimer { | |
return self.scheduledTimerWithTimeInterval(ti, target: | |
self, selector: "xxx_blcokInvoke:", userInfo: Block(block), repeats: repeats) | |
} |
func checkShouldDownloadFileAtLocation(urlString:String, completion:((shouldDownload:Bool) -> ())?) { | |
var request = NSMutableURLRequest(URL: NSURL(string: urlString)!) | |
request.HTTPMethod = "HEAD" | |
var session = NSURLSession.sharedSession() | |
var err: NSError? | |
var task = session.dataTaskWithRequest(request, completionHandler: { [weak self] data, response, error -> Void in | |
if let strongSelf = self { | |
var isModified = false |
kCFURLErrorUnknown = -998, | |
kCFURLErrorCancelled = -999, | |
kCFURLErrorBadURL = -1000, | |
kCFURLErrorTimedOut = -1001, | |
kCFURLErrorUnsupportedURL = -1002, | |
kCFURLErrorCannotFindHost = -1003, | |
kCFURLErrorCannotConnectToHost = -1004, | |
kCFURLErrorNetworkConnectionLost = -1005, | |
kCFURLErrorDNSLookupFailed = -1006, | |
kCFURLErrorHTTPTooManyRedirects = -1007, |
(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.
<?xml version="1.0"?> | |
<root> | |
<item> | |
<name>Change Return Key R</name> | |
<item> | |
<name>Return to Command_R</name> | |
<identifier>remap.return2commandR</identifier> | |
<autogen>__KeyToKey__ KeyCode::RETURN, KeyCode::COMMAND_R</autogen> | |
</item> | |
<item> |
EMACS_VER=24.3 | |
curl -O http://ftp.gnu.org/pub/gnu/emacs/emacs-${EMACS_VER}.tar.gz | |
curl -O https://gist.github.com/anonymous/8553178/raw/c0ddb67b6e92da35a815d3465c633e036df1a105/emacs.memory.leak.aka.distnoted.patch.diff | |
svn co http://svn.sourceforge.jp/svnroot/macemacsjp/inline_patch/trunk inline_patch | |
tar xvfz emacs-${EMACS_VER}.tar.gz | |
cd emacs-${EMACS_VER} |
(eval-when-compile (require 'cl)) | |
(defun* my/set-keybinds (map &rest key-and-func) | |
(loop with use-keymap = (keymapp map) | |
for i from 0 to (1- (length key-and-func)) by 2 | |
for key = (nth i key-and-func) | |
for formatted-key = (if (vectorp key) key (kbd key)) | |
for func = (nth (1+ i) key-and-func) | |
if use-keymap | |
do (define-key map formatted-key func) |
//RGB color macro | |
#define UIColorFromRGB(rgbValue) [UIColor \ | |
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ | |
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ | |
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] | |
//RGB color macro with alpha | |
#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor \ | |
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ | |
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ |
(defun es-make-minibuffer-frame () | |
(interactive) | |
(let* (( last-recursion-depth ) | |
( frame (make-frame '((width . 60) | |
(height . 4) | |
(minibuffer . only) | |
(title . "Emacs-Minibuffer")))) | |
( enable-recursive-minibuffers t) | |
;; Runs when going down a level, or when entering a prompt. Not ideal | |
( minibuffer-exit-hook (list (lambda () |