Skip to content

Instantly share code, notes, and snippets.

View stepanhruda's full-sized avatar

Stepan Hruda stepanhruda

  • Meta
  • New York
View GitHub Profile
struct BrokenTurnstyle {
private let previousState: WorkingTurnstyle
func machineRepairDidComplete() -> WorkingTurnstyle {
return previousState
}
}
struct WorkingTurnstyle {
@stepanhruda
stepanhruda / shell
Created February 23, 2016 15:29
swiftpm linking problems
$ swift build --init
Creating Package.swift
Creating .gitignore
Creating Sources/
Creating Sources/main.swift
Creating Tests/
$ swift build -v -Xcc -v
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a.xctoolchain/usr/lib/swift/pm -L /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /Users/stepanhruda/Documents/swiftpm-test/Package.swift
/usr/bin/xcrun --sdk macosx --show-sdk-path
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a.xctoolchain/usr/bin/swift-build-tool -v -f /Users/stepanhruda/Documents/swiftpm-test/.build/debug/swiftpm-test.o/llbuild.yaml
@stepanhruda
stepanhruda / dependency_injection.md
Last active February 11, 2016 22:17
Dependency injection

Two simple types using dependency injection.

struct CarKey {
  let ownerInitial: String
  let serialNumber: String

  init(ownerInitial: String, serialNumberGenerator: SerialNumberGenerator = SecureAndExpensiveSerialNumberGenerator()) {
    self.ownerInitial = ownerInitial
    self.serialNumber = serialNumberGenerator.generate()
@stepanhruda
stepanhruda / keybase.md
Created February 9, 2016 03:23
keybase.md

Keybase proof

I hereby claim:

  • I am stepanhruda on github.
  • I am stepanhruda (https://keybase.io/stepanhruda) on keybase.
  • I have a public key whose fingerprint is C20D 7796 6866 C389 0A80 038B 8C53 C9D6 3068 9010

To claim this, I am signing this object:

@stepanhruda
stepanhruda / crypto.c
Last active August 29, 2015 14:26 — forked from alloy/crypto.c
int _ccec_x963_import_priv_size(int arg0) {
rdi = arg0;
rax = 192;
if (rdi <= 198) {
if (rdi <= 144) {
if (rdi != 73) {
if (rdi == 85) {
rax = 224;
}
else {