- 1.5 oz Bulleit Bourbon
- 0.5 oz Captain Morgan Spiced Rum
- 0.5 oz lemon juice
- 0.5 oz maple syrup
- 0.75 oz apple cider
via http://noblexperiment.com/2012/10/20/fall-cocktail-recreate-my-apple-cider-donut/
// | |
// SKValueObject.h | |
// TinyType | |
// | |
// Created by Soroush Khanlou on 5/15/14. | |
// Copyright (c) 2014 Soroush Khanlou. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
#import <Foundation/Foundation.h> | |
@interface NSObject (IfClass) | |
- (id)ifClass:(Class)aClass; | |
@end |
import UIKit | |
extension UIColor: IntegerLiteralConvertible { | |
class func convertFromIntegerLiteral(value: IntegerLiteralType) -> UIColor { | |
let r = Double((value >> 16) & 0xFF) / 255; | |
let g = Double((value >> 8) & 0xFF) / 255; | |
let b = Double((value) & 0xFF) / 255; | |
return UIColor(red:r, green:g, blue:b, alpha:1.0) | |
} |
@interface MappedArray () | |
@property (nonatomic) NSArray *backingArray; | |
@end | |
@implementation MappedArray | |
- (instancetype)initWithArray:(NSArray *)array transformationBlock:(id (^)(id object))block { | |
self = [super init]; |
void (^block)(); | |
if (condition) { | |
block = ^{ | |
NSLog(@"some code"); | |
}; | |
} else { | |
block = ^{ | |
NSLog(@"other code"); | |
}; | |
} |
# requires https://github.com/originell/pycloudapp | |
from cloudapp.cloud import Cloud | |
import urllib | |
mycloud = Cloud() | |
mycloud.auth("username", "password") |
via http://noblexperiment.com/2012/10/20/fall-cocktail-recreate-my-apple-cider-donut/
func doThing(defaultable value: Int = 4, _ required: Void -> Int) -> Int { | |
return value + required() | |
} | |
doThing(defaultable: 4, { 6 }) // works | |
doThing { 6 } // works | |
doThing({ 6 }) // doesn't compile: Missing argument for parameter #2 in call |
extension SignedInteger { | |
func times() -> AnySequence<()> { | |
return AnySequence<()>({ () -> AnyIterator<()> in | |
var count: Self = 0 | |
return AnyIterator<()>({ | |
if count == self { | |
return nil | |
} |
import Foundation | |
extension Data { | |
var hexString1: String { | |
return self.map({ return String(format: "%02hhx", $0) }).joined() | |
} | |
var hexString2: String { | |
return self.reduce("", { return $0 + String(format: "%02hhx", $1) }) |