(Full description and list of commands at - https://npmjs.org/doc/index.html)
##List of less common (however useful) NPM commands
######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:
// | |
// UIView+CustomTimingFunction.h | |
// Instants | |
// | |
// Created by Christian Giordano on 16/10/2013. | |
// Copyright (c) 2013 Christian Giordano. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
CGAffineTransform CGAffineTransformFromRectToRect(CGRect fromRect, CGRect toRect) | |
{ | |
CGSize scale = CGSizeMake(toRect.size.width / fromRect.size.width, toRect.size.height / fromRect.size.height); | |
CGRect scaledFromRect = CGRectMake(fromRect.origin.x * scale.width, fromRect.origin.y * scale.height, | |
fromRect.size.width * scale.width, fromRect.size.height * scale.height); | |
CGSize translation = CGSizeMake(fromRect.origin.x - scaledFromRect.origin.x, fromRect.origin.y - scaledFromRect.origin.y); | |
return CGAffineTransformMake(scale.width, 0.0, 0.0, scale.height, translation.width, translation.height); | |
} |
function extend(destination, source) { | |
for (var k in source) { | |
// console.log(k) | |
if (source.hasOwnProperty(k)) { | |
destination[k] = source[k]; | |
} | |
} | |
return destination; | |
} |
function (receiver, supplier) { | |
Object.keys(supplier).forEach(function (property) { | |
Object.defineProperty(receiver, property, Object.getOwnPropertyDescriptor(supplier, property)); | |
}); | |
} |
import Foundation | |
typealias CancelableTask = (cancel: Bool) -> Void | |
func delay(time: NSTimeInterval, work: dispatch_block_t) -> CancelableTask? { | |
var finalTask: CancelableTask? | |
var cancelableTask: CancelableTask = { cancel in | |
if cancel { |
var origin: CGPoint? | |
var radius: CGFloat? | |
var locations: [CGFloat]? | |
var colors: [UIColor]? | |
override func drawInContext(ctx: CGContext!) { | |
super.drawInContext(ctx) | |
if let colors = self.colors { | |
if let locations = self.locations { | |
if let origin = self.origin { |
UIImage *TintImageWithTintColor(UIImage *image, UIColor *tintColor) { | |
// Huge props to http://stackoverflow.com/questions/3514066/how-to-tint-a-transparent-png-image-in-iphone | |
UIGraphicsBeginImageContext(image.size); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGContextTranslateCTM(context, 0, image.size.height); | |
CGContextScaleCTM(context, 1.0, -1.0); | |
CGRect rect = (CGRect){ CGPointZero, image.size }; |
// | |
// main.swift | |
// Test | |
// | |
// Created by Chris Eidhof on 29/08/15. | |
// Copyright © 2015 Chris Eidhof. All rights reserved. | |
// | |
import Foundation | |
import Quartz |
(Full description and list of commands at - https://npmjs.org/doc/index.html)
##List of less common (however useful) NPM commands
######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:
- (NSAttributedString *)loadContent { | |
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"input" ofType:@"html"]; | |
NSData *htmlData = [NSData dataWithContentsOfFile:filePath]; | |
NSDictionary *options = @{ | |
NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, | |
NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding) | |
}; | |