Skip to content

Instantly share code, notes, and snippets.

View u10int's full-sized avatar

Nicholas Shipes u10int

View GitHub Profile
/**
* @author Eberhard Graether / http://egraether.com/
*/
THREE.TrackballControls = function ( object, domElement ) {
var _this = this;
var STATE = { NONE: -1, ROTATE: 0, ZOOM: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_ZOOM: 4, TOUCH_PAN: 5 };
this.object = object;
@u10int
u10int / TabBarController.swift
Created May 9, 2018 18:30 — forked from JillevdW/TabBarController.swift
TabBar with moving selectionIndicatorImage
import UIKit
class TabBarController: UITabBarController {
var indicatorImage: UIImageView?
override func viewDidLoad() {
super.viewDidLoad()
let numberOfItems = CGFloat(tabBar.items!.count)
@u10int
u10int / KeyboardLayoutGuide.swift
Created July 24, 2017 22:57 — forked from myell0w/KeyboardLayoutGuide.swift
A UILayoutGuide that follows the Keyboard on iOS
import Foundation
import UIKit
/// Used to create a layout guide that pins to the top of the keyboard
final class KeyboardLayoutGuide {
private let notificationCenter: NotificationCenter
private let bottomConstraint: NSLayoutConstraint
@u10int
u10int / PolygonOverlayRenderer.m
Last active March 14, 2017 00:05
Polygon Overlay Renderer
@implementation PolygonOverlayRenderer
- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context {
if (!MKMapRectIntersectsRect(self.overlay.boundingMapRect, mapRect)) {
return;
}
UIGraphicsPushContext(context);
// overlay is a custom MKOverlay that contains multiple polygons and polylines for this renderer to draw
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
export ALREADYINVOKED="true"
@u10int
u10int / universal-framework.sh
Last active July 24, 2017 23:42 — forked from cromandini/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@u10int
u10int / Cache.swift
Created January 12, 2017 03:00 — forked from mohamede1945/Cache.swift
General purpose Cache for Swift, No AnyObject restrictions! Can be used with Structs
extension Hashable {
var hashNumber: NSNumber {
return NSNumber(value: hashValue)
}
}
private class ObjectWrapper {
let value: Any
init(_ value: Any) {
/**
A default implmentation that provides a few convenience methods for starting and stopping coordinators.
*/
extension Coordinator {
// Default implementation, so that we don't have to do this for all coordinators.
func startChild<T: NSObject where T: Coordinator>(coordinator coordinator: T, withIdentifier identifier: String, callback: CoordinatorCallback?) -> T {
childCoordinators[identifier] = coordinator
coordinator.start(withCallback: callback)
return coordinator
@u10int
u10int / Cacher.swift
Created December 14, 2016 20:03 — forked from raulriera/Cacher.swift
Code sample for Medium article about Caching and Protocols
public protocol Cachable {
var fileName: String { get }
func transform() -> Data
}
final public class Cacher {
let destination: URL
private let queue = OperationQueue()
public enum CacheDestination {
@u10int
u10int / FRP iOS Learning resources.md
Created October 25, 2016 00:44 — forked from JaviLorbada/FRP iOS Learning resources.md
The best FRP iOS resources.

Videos