Skip to content

Instantly share code, notes, and snippets.

@seivan
seivan / firstDifferenceBetweenStrings.swift
Created July 7, 2016 11:41 — forked from kristopherjohnson/firstDifferenceBetweenStrings.swift
Swift code to find differences between strings and display them in a readable way, useful for displaying unit test results
import Foundation
/// Find first differing character between two strings
///
/// :param: s1 First String
/// :param: s2 Second String
///
/// :returns: .DifferenceAtIndex(i) or .NoDifference
public func firstDifferenceBetweenStrings(s1: NSString, s2: NSString) -> FirstDifferenceResult {
@seivan
seivan / lexer.swift
Created June 5, 2016 14:00 — forked from radex/lexer.swift
Wrote a little lexer/tokenizer for fun. (Warning: I have no idea what I'm doing)
import Foundation
struct Stream {
let string: NSString
var position: Int
var matchingRange: NSRange {
return NSRange(location: position, length: string.length - position)
}
}
@seivan
seivan / responder-chain.swift
Created June 2, 2016 07:27 — forked from RoyalIcing/responder-chain.swift
Responder chain in Swift using enums
//: Responder chain in Swift using enums
protocol CommandProtocol {}
protocol Responder: class {
var nextResponder: Responder? { get }
func performerForCommand
<Command : CommandProtocol>
(command: Command) -> (() -> ())?
@seivan
seivan / gist:0a38c293ecf9a03eaf59c9034f9c6b06
Last active May 25, 2016 15:12 — forked from alexandreraulin/gist:f4b1504aec9d25f5af08
Script for iOS Universal Framework compilation with Xcode 6
# This script is based on Jacob Van Order's answer on apple dev forums https://devforums.apple.com/message/971277
# See also http://spin.atomicobject.com/2011/12/13/building-a-universal-framework-for-ios/ for the start
# To get this to work with a Xcode 6 Cocoa Touch Framework, create Framework
# Then create a new Aggregate Target. Throw this script into a Build Script Phrase on the Aggregate
######################
# Options
@seivan
seivan / build-universal-framework.sh
Last active May 25, 2016 14:30 — forked from ulhas/build-universal-framework.sh
Script for building universal framework used in HyperTrack iOS SDK
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=../build/
# make the output directory and delete the framework directory
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
rm -rf "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework"
# Step 1. Build Device and Simulator versions
set -o pipefail && xctool -workspace "../${WORKSPACE_NAME}" -scheme "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | xcpretty
@seivan
seivan / package_framework.rb
Created May 25, 2016 14:29 — forked from ulhas/package_framework.rb
Fastlane - private lane for 'package_framework`
desc "Zip and copy to right folder"
private_lane :package_framework do |lane|
if !lane[:framework]
raise "No framework specified!".red
end
if !lane[:version]
raise "No version specified!".red
end
@seivan
seivan / deploy_framework.rb
Created May 25, 2016 14:29 — forked from ulhas/deploy_framework.rb
Fastlane - private lane for 'deploying framework'
desc "Deploy/upload framework"
private_lane :deploy_framework do |lane|
if !lane[:framework]
raise "No framework specified!".red
end
if !lane[:version]
raise "No version specified!".red
end
@seivan
seivan / fastfile
Created May 25, 2016 14:29 — forked from ulhas/fastfile
Fastfile for HyperTrack iOS SDKs
fastlane_version "1.57.0"
require 'fileutils'
default_platform :ios
platform :ios do
desc "Increment framework version"
private_lane :increment_framework_version do |lane|
/** @jsx React.DOM */
var SVGComponent = React.createClass({
render: function() {
return this.transferPropsTo(
<svg>{this.props.children}</svg>
);
}
});
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface KurdStyle : NSObject
// Colors
+ (UIColor*)mainColor;
+ (UIColor*)shadowColor;