#Every Single Option Under The Sun
- optimization level options
- automatic crashing options
- debug info options
- swift internal options
- swift debug/development internal options
- linker-specific options
- mode options
NSURLConnection | NSURLSession | |
------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------- | |
NSURLConnectionDelegate connectionShouldUseCredentialStorage: | | |
------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------- | |
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler: | |
| N |
import Foundation | |
extension String | |
{ | |
var length: Int { | |
get { | |
return countElements(self) | |
} | |
} | |
// | |
// Swift-KVO | |
// | |
// Created by Jim Correia on 6/5/14. | |
// Copyright (c) 2014-2015 Jim Correia. All rights reserved. | |
// | |
// Update: 6/17/2014 | |
// | |
// KVOContext has gone away; use the same idiom you'd use from Objective-C for the context | |
// |
#Every Single Option Under The Sun
/* The Y combinator in Swift! | |
For a discussion of what the heck this is all about, see http://www.ece.uc.edu/~franco/C511/html/Scheme/ycomb.html | |
The nifty thing is that it allows us to implement recursion without the ability for a function to refer to itself from within its own definition. | |
Note how we manage a recursive definition of factorial without any function referring to its own name. | |
Thanks to @eridius for help with the SelfToUnderlying<T> type. | |
*/ |
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) | |
/* | |
var t = Timer() | |
t.start() | |
// do something | |
t.stop() | |
print("took \(t.seconds)") | |
*/ |
import Foundation | |
protocol GQLNodeArgument {} | |
extension String: GQLNodeArgument {} | |
extension NSNumber: GQLNodeArgument {} | |
class GQLNode: StringLiteralConvertible, ArrayLiteralConvertible, Printable, DebugPrintable { | |
let name: String? |
func partial<A, B, T>(f: (A, B) -> T, a: A) -> (B) -> T { | |
return { f(a, $0) } | |
} | |
func bind2nd<A, B, T>(f: (A, B) -> T, b: B) -> (A) -> T { | |
return { f($0, b) } | |
} | |
func partial<A, B, C, T>(f: (A, B, C) -> T, a: A) -> (B, C) -> T { |
#!/bin/sh | |
git filter-branch --env-filter ' | |
an="$GIT_AUTHOR_NAME" | |
am="$GIT_AUTHOR_EMAIL" | |
cn="$GIT_COMMITTER_NAME" | |
cm="$GIT_COMMITTER_EMAIL" | |
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ] |