This file contains 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/sh | |
if [ -t 1 ]; then | |
echo LOL >&2 | |
exit 1 | |
else | |
real_git=$(type -a git | head -2 | tail -1 | cut -d" " -f 3) | |
exec "$real_git" ${*} | |
fi |
This file contains 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
require "rspec/autorun" | |
class Enumerator::Lazy | |
def reduce(*) | |
Lazy.new([nil]) do |yielder, _| | |
yielder << super | |
end | |
end | |
def join(separator="") |
This file contains 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
Process: Xcode [56151] | |
Path: /Applications/Xcode.app/Contents/MacOS/Xcode | |
Identifier: com.apple.dt.Xcode | |
Version: 6.3.2 (7718) | |
Build Info: IDEFrameworks-7718000000000000~2 | |
App Item ID: 497799835 | |
App External ID: 812404257 | |
Code Type: X86-64 (Native) | |
Parent Process: ??? [1] | |
Responsible: Xcode [56151] |
This file contains 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
/// An API for managing UIKit background tasks by composing signals. | |
@interface UIApplication (SHReactiveBackgroundTask) | |
/// Creates a signal that wraps an underlying signal in a background task. | |
/// Upon subscription, starts a background task, and then automatically ends | |
/// the background task when the underlying signal completes or errors. | |
/// If the background task expires, the subscription to the underlying signal | |
/// will automatically be disposed of. | |
/// | |
/// @note If the call to `-beginBackgroundTaskWithExpirationHandler:` returns |
This file contains 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
import Kiwi | |
import XCTest | |
class KiwiSpec: KWSpec { | |
override class func buildExampleGroups() { | |
it("has a test") { | |
XCTAssert(1 + 1 == 2) | |
} | |
} | |
} |
This file contains 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
# View on GitHub: https://github.com/sharplet/Switch | |
# Try it yourself: git clone https://github.com/sharplet/Switch.git && cd Switch && rake | |
$ rake | |
mkdir -p Build | |
mkdir -p Build/Switch.framework | |
mkdir -p Build/Switch.framework/Versions/A/Modules/Switch.swiftmodule | |
ln -sf A Build/Switch.framework/Versions/Current | |
ln -sf Versions/Current/Modules Build/Switch.framework/Modules | |
ln -sf Versions/Current/Switch Build/Switch.framework/Switch | |
xcrun -sdk macosx swiftc -module-name Switch -emit-library -o Build/Switch.framework/Versions/Current/Switch -- Source/Array+Ext.swift Source/Option.swift Source/ParseResult.swift Source/Parser.swift Source/String+Ext.swift |
This file contains 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
$ rake | |
mkdir -p Build | |
mkdir -p Build/Switch.framework | |
mkdir -p Build/Switch.framework/Versions/A/Modules/Switch.swiftmodule | |
ln -sf A Build/Switch.framework/Versions/Current | |
ln -sf Versions/Current/Modules Build/Switch.framework/Modules | |
ln -sf Versions/Current/Switch Build/Switch.framework/Switch | |
xcrun -sdk macosx swiftc -module-name Switch -emit-library -o Build/Switch.framework/Versions/Current/Switch -- Source/Switch.swift | |
xcrun -sdk macosx swiftc -module-name Switch -emit-module-path Build/Switch.framework/Versions/A/Modules/Switch.swiftmodule/x86_64.swiftmodule -- Source/Switch.swift | |
touch Build/Switch.framework |
This file contains 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
AlignTrailingComments: true | |
AllowShortFunctionsOnASingleLine: Inline | |
AllowShortIfStatementsOnASingleLine: true | |
BasedOnStyle: LLVM | |
BreakBeforeBraces: Attach | |
ColumnLimit: 120 | |
IndentWidth: 2 | |
KeepEmptyLinesAtTheStartOfBlocks: false | |
ObjCSpaceAfterProperty: true | |
ObjCSpaceBeforeProtocolList: true |
This file contains 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 + <S: SequenceType, E where S.Generator.Element == E> (lhs: S, rhs: S) -> GeneratorOf<E> { | |
var (g, h) = (lhs.generate(), rhs.generate()) | |
return GeneratorOf { | |
g.next() ?? h.next() | |
} | |
} |
This file contains 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
/// Convert a free method into a regular funcion accepting an instance as the first parameter. | |
func method<A, B>(m: A -> () -> B) -> A -> B { | |
return { m($0)() } | |
} | |
let strings = ["1", "2", "3", "foo"] | |
strings.map(method(String.toInt)) | |
// => [{Some 1}, {Some 2}, {Some 3}, nil] |