(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 example shows how higher-kinded types can be emulated in Swift today. | |
| // It acheives correct typing at the cost of some boilerplate, manual lifting and an existential representation. | |
| // The technique below was directly inspired by the paper Lightweight Higher-Kinded Polymorphism | |
| // by Jeremy Yallop and Leo White found at http://ocamllabs.io/higher/lightweight-higher-kinded-polymorphism.pdf | |
| /// `ConstructorTag` represents a type constructor. | |
| /// `Argument` represents an argument to the type constructor. | |
| struct Apply<ConstructorTag, Argument> { | |
| /// An existential containing a value of `Constructor<Argument>` | |
| /// Where `Constructor` is the type constructor represented by `ConstructorTag` |
| #!/bin/bash | |
| apk_file=$1 | |
| if [ -z $apk_file ]; then | |
| apk_file_num=`ls *.apk | wc -l | tr -d ' '` | |
| if [ $apk_file_num -gt 1 ]; then | |
| echo "Ambiguous apk_files. Please enter one APK to inspect." | |
| exit -1 | |
| fi | |
| apk_file=`ls *.apk` |
| class ExampleViewController: UIViewController, UITextViewDelegate { | |
| @IBOutlet var placeholderInput: UIPlaceHolderTextView! { | |
| didSet { | |
| placeholderInput.placeholder = "Your custom placeholder text here" | |
| placeholderInput.placeholderColor = UIColor.redColor() // what ever color you want here too | |
| placeholderInput.text = placeholderInput.placeholder | |
| placeholderInput.textColor = placeholderInput.placeholderColor | |
| placeholderInput.selectedTextRange = placeholderInput.textRangeFromPosition(placeholderInput.beginningOfDocument, toPosition: placeholderInput.beginningOfDocument) |
| /// Observes a run loop to detect any stalling or blocking that occurs. | |
| /// | |
| /// This class is thread-safe. | |
| @interface GHRunLoopWatchdog : NSObject | |
| /// Initializes the receiver to watch the specified run loop, using a default | |
| /// stalling threshold. | |
| - (id)initWithRunLoop:(CFRunLoopRef)runLoop; | |
| /// Initializes the receiver to detect when the specified run loop blocks for |
(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.
| // | |
| // CGPathBevel.h | |
| // | |
| // Created by Aaron Hayman on 6/21/12. | |
| // Copyright (c) 2012 FlexileSoft, LLC. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> | |
| void bevelPath(CGPathRef path, CGContextRef context, CGFloat bevelDepth, CGColorRef highlight, CGColorRef shadow, CGFloat lightSourceAngle, BOOL evenOddShadows, BOOL eofFill); |