I hereby claim:
- I am seanlilmateus on github.
- I am mateus (https://keybase.io/mateus) on keybase.
- I have a public key whose fingerprint is E743 5955 91BF 409E 8E63 C31A DFCB 4F92 E6CD BAD2
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import Cocoa | |
extension NSObject { | |
func tap(blk:(AnyObject) -> Void) -> Self { | |
blk(self as NSObject) | |
return self | |
} | |
} | |
// Alternative, you will need to specify the type :: view:NSView = ... |
operator infix |⋅⋅ {} | |
@infix func |⋅⋅ (lhs: Int, rhs: Int) -> Range<Int> { | |
return Range(start: lhs + 1, end: rhs) | |
} | |
operator infix |⋅⋅| {} | |
@infix func |⋅⋅|(lhs: Int, rhs: Int) -> Range<Int> { | |
return Range(start: lhs+1, end: rhs-1) | |
} |
#!/usr/bin/env xcrun swift -i | |
import Foundation | |
// MARK: From String Protocol | |
protocol FromStr { | |
class func fromStr(value: String) -> Self? | |
} | |
extension Bool : FromStr { | |
static func fromStr(str: String) -> Bool? { |
#!/usr/bin/env xcrun swift | |
// http://learnyouahaskell.com/functionally-solving-problems | |
enum Label : String { case A = "A", B = "B", C = "C" } | |
typealias Section = (Int, Int, Int) | |
typealias RoadSystem = [Section] | |
typealias Path = [(name:Label, price:Int)] | |
// Helpers, A little bit of F# in my life | |
infix operator |> { associativity left } |
use std::num::Int; | |
fn factorial<T: Int>(num: &T) -> T { | |
if *num == T::zero() || *num == T::one() { | |
T::one() | |
} else { | |
*num * factorial(&(*num - T::one())) | |
} | |
} |
class StatusBarView < NSView | |
attr_reader :progressIndicator, :statusBarItem | |
def initWithStatusBarItem(item) | |
bar = item.statusBar | |
if initWithFrame([[0,0], [bar.thickness, bar.thickness]]) | |
@statusBarItem = item | |
@highlight = false | |
origin, size = frame.origin, frame.size |
# 1 # Processing enumerated arrays using two blocks | |
area = "Europe" | |
timeZoneNames = NSTimeZone.knownTimeZoneNames | |
areaArray = NSMutableArray.arrayWithCapacity 1 | |
areaIndexes = timeZoneNames.indexesOfObjectsWithOptions NSEnumerationConcurrent, | |
passingTest: -> (obj, idx, stop) { | |
tmpStr = obj | |
tmpStr.hasPrefix area | |
} | |
tmpArray = timeZoneNames.objectsAtIndexes areaIndexes |
class ForwardError | |
attr_accessor :pointer | |
def self.new | |
@pointer = Pointer.new_with_type('@') | |
self | |
end | |
def self.to_pointer | |
@pointer | |
end | |
def self.method_missing(method, *args) |