Moved to repository: https://github.com/Mailcloud/swift-serializer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (m *MersenneTwister) Urand32() uint32 { | |
if m.index == 0 { | |
m.generate_numbers() | |
} | |
y := m.State[m.index] | |
y = y ^ (y >> 11) // | |
y = y ^ ((y << 7) & 2636928640) // | |
y = y ^ ((y << 15) & 4022730752) // | |
y = y ^ (y >> 18) // "y XOR leftmost 14 bits of y" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# Copyright (c) 2011 Float Mobile Learning | |
# http://www.floatlearning.com/ | |
# Extension Copyright (c) 2013 Weptun Gmbh | |
# http://www.weptun.de | |
# Extension Copyright (c) 2013 FoundryLogic LLC | |
# http://foundrylogic.com | |
# | |
# Extended by Ronan O Ciosoig January 2012 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct S0<V> { | |
typealias F = () -> V | |
} | |
struct S1<T1,V>{ | |
typealias F = (T1) -> V | |
} | |
//0, 0 | |
func curry<T1, V>(f: S1<T1, V>.F, a1:T1) -> S0<V>.F { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#=============================================================================== | |
# Filename: boost.sh | |
# Author: Pete Goodliffe | |
# Copyright: (c) Copyright 2009 Pete Goodliffe | |
# Licence: Please feel free to use this, with attribution | |
# Modified version | |
#=============================================================================== | |
# | |
# Builds a Boost framework for iOS, iOS Simulator, and OSX. | |
# Creates a set of universal libraries that can be used on an iOS and in the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func encode<T>(var value: T) -> NSData { | |
return withUnsafePointer(&value) { p in | |
NSData(bytes: p, length: sizeofValue(value)) | |
} | |
} | |
func decode<T>(data: NSData) -> T { | |
let pointer = UnsafeMutablePointer<T>.alloc(sizeof(T.Type)) | |
data.getBytes(pointer) | |
WARNING These steps are probably out dated and will not work.
To re-sign an iOS app with another developer account, ensure that the following are in place first.
- Distribution certificate of the other developer account
- A provisioning profile from the other developer account
Note that the Apple requires bundle IDs to be globally unique, even across accounts. So a bundle ID i.e. CFBundleIdentifier
from one account can't be used in a different account, even though the team id/prefix would be different.
Ensure that the new distribution certificate is in your keychain and the new provisioning profile on your disk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSTimer { | |
/** | |
Creates and schedules a one-time `NSTimer` instance. | |
- Parameters: | |
- delay: The delay before execution. | |
- handler: A closure to execute after `delay`. | |
- Returns: The newly-created `NSTimer` instance. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NSScanner+Swift.swift | |
// A set of Swift-idiomatic methods for NSScanner | |
// | |
// (c) 2015 Nate Cook, licensed under the MIT license | |
import Foundation | |
extension NSScanner { | |
// MARK: Strings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infix operator « { precedence 131 associativity left } | |
func «<A,B,C>(a:A, f:(A,B) -> C) -> B -> C { return { f(a,$0) } } | |
infix operator » { precedence 131 associativity left } | |
func »<B,C>(f:(B) -> C, b:B) -> C { return f(b) } | |
infix operator < { precedence 131 associativity left } | |
func <<A,B,C>(a:A, f:(A,B) -> C) -> B -> C { return { f(a,$0) } } | |
infix operator > { precedence 131 associativity left } |