Skip to content

Instantly share code, notes, and snippets.

'use strict';
var React = require('react-native');
console.log('React:', React)
var {
View,
StyleSheet,
PanResponder,
Animated
} = React;
### Stack
```
CocoaPods : 0.37.2
Ruby : ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]
RubyGems : 2.0.14
Host : Mac OS X 10.11 (15A204h)
Xcode : 7.0 (7A121l)
Git : git version 2.3.7 (Apple Git-57)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
// Consider a generic class where `lhs` and `rhs` can be of any numeric type
struct Operation: Printable {
let lhs: Float
let rhs: Float
let `operator`: Operator
var description: String {
return "\(lhs) \(`operator`.symbol) \(rhs)"
}
}
@justinmakaila
justinmakaila / UICollectionViewExtensions
Created March 19, 2015 19:07
UICollectionView+NibView
import UIKit
extension UICollectionView {
// MARK: - Dequeue Nib Views
func dequeueNibView<T: UICollectionViewCell where T: ReuseIdentifierProtocol>(view: T.Type, indexPath: NSIndexPath) -> T {
return dequeueReusableCellWithReuseIdentifier(view.reuseIdentifier(), forIndexPath: indexPath) as T
}
func dequeueSupplementaryReusableNibView<T: UICollectionReusableView where T: ReuseIdentifierProtocol>(view: T.Type, kind: String, indexPath: NSIndexPath) -> T {
#!/bin/sh
function set_base_flags() {
export GYP_GENERATORS="ninja"
export GYP_DEFINES="build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1"
}
function set_base_ios_flags() {
set_base_flags
@justinmakaila
justinmakaila / AlamofireExtensions.swift
Last active August 29, 2015 14:14
Alamofire JSONSerializable Extensions
import Foundation
import Alamofire
import SwiftyJSON
typealias AlamofireResponseCompletion = (NSURLRequest, NSHTTPURLResponse?, AnyObject?, NSError?) -> Void
private let QueueIdentifier: String = "com.alamofire.Alamofire.SerializationQueue"
private let ErrorDomain: String = "com.alamofire.Alamofire.responseJSONSerializable"
// MARK: - Serializer for the API
@justinmakaila
justinmakaila / JSONSerializable.swift
Created February 6, 2015 19:38
JSON Serializable Protocol
import Foundation
import SwiftyJSON
typealias ObjectJSON = JSON
protocol JSONSerializable {
init(json: ObjectJSON)
}
@justinmakaila
justinmakaila / FeedViewController.swift
Last active August 29, 2015 14:14
Uses ReactiveCocoa to provide a view controller, protocol, and view model to present a simple table-driven feed.
//
// FeedViewController.swift
// ProjectDemand
//
// Created by Justin Makaila on 1/13/15.
// Copyright (c) 2015 Present. All rights reserved.
//
import UIKit
import TableAdapter
import UIKit
extension UIView {
class func instantiateNibView<T: UIView where T: NibView>(type: T.Type) -> T {
return type.nib().instantiateWithOwner(nil, options: nil).first! as T
}
}
@justinmakaila
justinmakaila / UITableView+NibView.swift
Last active August 29, 2015 14:14
UITableView+NibView
import UIKit
extension UITableView {
// MARK: - Dequeue Nib Views
func dequeueNibView<T: UITableViewCell where T: ReuseIdentifierProtocol>(view: T.Type) -> T {
return dequeueReusableCellWithIdentifier(view.reuseIdentifier()) as T
}