Skip to content

Instantly share code, notes, and snippets.

View nubbel's full-sized avatar

Dominique d'Argent nubbel

View GitHub Profile
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)
import Foundation
struct Meter {
var value: Double
init(_ value: Double) {
self.value = value
}
var mm: Double { return value * 1000.0 }
import Foundation
extension NSURL : StringLiteralConvertible {
class func convertFromStringLiteral(value: String) -> Self {
return self(string: value)
}
class func convertFromExtendedGraphemeClusterLiteral(value: String) -> Self {
return self(string: value)
extension Array {
var first: T? {
if isEmpty {
return nil
}
return self[0]
}
protocol ArrayRepresentable {
typealias ArrayType
func toArray() -> ArrayType[]
}
extension Range : ArrayRepresentable {
func toArray() -> T[] {
return T[](self)
}
// 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)
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
class GooglePlayVerification
require 'google/api_client'
# Refer:
# https://code.google.com/p/google-api-ruby-client/issues/detail?id=72
# and
# http://jonathanotto.com/blog/google_oauth2_api_quick_tutorial.html
# and
# http://milancermak.wordpress.com/2012/08/24/server-side-verification-of-google-play-subsc/
GOOGLE_KEY = 'xxx-xxx.apps.googleusercontent.com'

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:

$ torquebox run
...
18:29:11,620 INFO [org.torquebox.core.runtime.DefaultRubyRuntimePool] (pool-1-thread-2) Deferring start for stomplets runtime pool.
...
18:29:11,629 INFO [org.torquebox.core.runtime] (pool-6-thread-1) Creating ruby runtime (ruby_version: RUBY1_9, compile_mode: JIT, app: BulletinBoard, context: stomplets)
...
18:29:27,121 INFO [org.torquebox.core.runtime] (pool-6-thread-1) Created ruby runtime (ruby_version: RUBY1_9, compile_mode: JIT, app: BulletinBoard, context: stomplets) in 15.49s
...
18:29:27,835 INFO [stdout] (pool-1-thread-4) [#<BulletinsStomplet:0x120d47>#configure] destination: [Topic: /topics/warp]
> reload in chrome