Skip to content

Instantly share code, notes, and snippets.

View nubbel's full-sized avatar

Dominique d'Argent nubbel

View GitHub Profile

Keybase proof

I hereby claim:

  • I am nubbel on github.
  • I am nubbel (https://keybase.io/nubbel) on keybase.
  • I have a public key whose fingerprint is 2717 7536 8AFF A2FF BD23 0F98 237D 1A2D BD7F E5B9

To claim this, I am signing this object:

export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
// Playground - noun: a place where people can play
let list: Int[] = [1, 2, 3, 4, 5, 6]
func sum (a: Int, b: Int) -> Int {
return a + b;
}
// function
list.reduce(0, combine: sum)
extension Array {
var first: T? {
if isEmpty {
return nil
}
return self[0]
}
infix operator < { associativity left }
func <<T : Comparable>(lhs: T, rhs: T) -> ((T, T) -> Bool, () -> T) -> Bool {
return { (op: (T, T) -> Bool, value: () -> T) in
(lhs < rhs) && op(rhs, value())
}
}
func <<T: Comparable>(lhs: ((T, T) -> Bool, () -> T) -> Bool, rhs: @autoclosure () -> T) -> Bool {
return lhs({$0 < $1}, rhs)
infix operator < { associativity left }
// left-most comparison
func <<T : Comparable>(lhs: T, rhs: T) -> ((T, T) -> Bool, () -> T) -> Bool {
return { (op: (T, T) -> Bool, value: () -> T) in
(lhs < rhs) && op(rhs, value())
}
}
// mid comparisons
// Interpol.playground
import CoreGraphics
typealias Time = CFTimeInterval
typealias Value = CGFloat
typealias Point = CGPoint
typealias Vector = CGVector
typealias Size = CGSize
typealias Rect = CGRect
class ViewModel
class Attribute
attr_reader :name
attr_accessor :model_value, :view_value
def initialize(name, model_value = :_undefined, view_value = :_undefined)
@name = name
@model_value = model_value
@view_value = view_value
end
final class Box<T> {
let value: T
init(_ value: T) {
self.value = value
}
}
protocol DataType : Printable {
//
// NNBlockDelegate.h
//
// Created by Dominique d'Argent on 1/8/13.
// Copyright (c) 2013 Dominique d'Argent. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NNBlockDelegate : NSObject