Skip to content

Instantly share code, notes, and snippets.

View JonB's full-sized avatar

Jon Blower JonB

View GitHub Profile
@JonB
JonB / A_Promise.swift
Created October 9, 2016 23:43 — forked from ChristianKienle/A_Promise.swift
simplest Promise framework possible?
public struct Promise<T> {
typealias Fulfiller = (T) -> (Void)
typealias Rejecter = (Void) -> (Void)
typealias Resolver = (_ fulfill: @escaping Fulfiller, _ reject: @escaping Rejecter) -> (Void)
let resolver: Resolver
init(_ resolver: @escaping Resolver){
self.resolver = resolver
}
func then<U>(_ execute: @escaping ((T) -> U)) -> Promise<U> {
return Promise<U>({(fulfill, reject) in
#!/usr/bin/env ruby
#
# Mac fix 1 - Install the Nokogiri gem on Mac OS 10.9 Mavericks
#
# Usage: to configure and install using Bundler, pass in 'bundle' as an argument to the script.
#
# Nokogiri works at a very low level, so it has many issues on various platforms.
# As a result, the command `install gem nokogiri` often will fail. This fix is for
# errors involving 'libiconv', such as the following one I encountered:
#
@JonB
JonB / gist:1767992
Created February 8, 2012 10:27
CA Test
- (IBAction)goButtonPressed:(id)sender
{
CALayer *layer = self.theRedSquare.layer;
CATransform3D initialTransform = self.theRedSquare.layer.transform;
initialTransform.m34 = 1.0 / -1000;
layer.transform = initialTransform;
layer.anchorPoint = CGPointMake(0.0, 0.5);
[UIView beginAnimations:@"com.jon.Scale" context:nil];
[UIView setAnimationDuration:1];