Skip to content

Instantly share code, notes, and snippets.

View marciok's full-sized avatar
🎯
Focusing

Marcio Klepacz marciok

🎯
Focusing
View GitHub Profile
import PackageDescription
let package = Package(
name: "example",
dependencies: [
.Package(url: "https://github.com/marciok/CRuby", majorVersion: 1)
]
)
module CRuby {
header "/usr/local/var/rbenv/versions/2.2.5/include/ruby-2.2.0/ruby.h" // If it can't find ,check where rbenv is installed: echo $RBENV_ROOT
link "ruby"
export *
}
@marciok
marciok / sum.swift
Last active April 4, 2016 07:45
Addition without the plus operator
//
// Addition without `+` operator
//
func sum(n1: Int, n2: Int) -> Int {
let result = n1 ^ n2
let carry = (n1 & n2) << 1
if carry != 0 {
return sum(result, n2: carry)
@marciok
marciok / functiona-tic-tac-toe.swift
Last active March 23, 2016 15:59
Tic-Tac-Toe game written in Swift using a functional programming approach.
// Tic-Tac-Toe game written in Swift using a functional programming approach.
import UIKit
struct Board {
let field: [[String]]
let currentState: State
init(field: [[String]], currentState: State) {
class Pony {
// Now with final
func final genus() -> String {
return "Equus"
}
}
print(Pony().genus())
class Unicorn {
final func numbersOfHorns() -> Int {
return 1
}
}
// If we try to override the method.
class Horse: Unicorn {
override func numbersOfHorns() -> Int { // ERROR: Instance method overrides a 'final' instance method
/**
* Multi line comments were added by me (Marcio) the single lines were added by swiftc
**/
sil_stage raw
import Builtin
import Swift
import SwiftShims
/**
* Multi line comments were added by me (Marcio) the single lines were added by swiftc
**/
sil_stage raw
import Builtin
import Swift
import SwiftShims
class Pony {
// WITHOUT final
func genus() -> String {
return "Equus"
}
}
print(Pony().genus())
#!/bin/sh
key_chain=ios-build.keychain
security create-keychain -p travis $key_chain
# Make the keychain the default so identities are found
security default-keychain -s $key_chain
# Unlock the keychain
security unlock-keychain -p travis $key_chain
# Set keychain locking timeout to 3600 seconds