Update (HT Cryptix): If we make sure we have the net/context package from github by running
go get golang.org/x/net/context
and then change the import statements in the server and client source from
import ( "code.google.com/p/go.net/context" )
Far out in the uncharted backwaters of the unfashionable end | |
of the Western Spiral arm of the Galaxy lies a small | |
unregarded yellow sun. | |
Orbiting this at a distance of roughly ninety-two million | |
miles is an utterly insignificant little blue green planet whose | |
ape-descended life forms are so amazingly primitive that | |
they still think digital watches are a pretty neat idea. | |
This planet has – or rather had – a problem, which was |
// Here are the definitions of the tags used to toggle the various debug logs. | |
//#define TGLOG_ALL | |
#define TGLOG_TMP | |
#define TGLog(tag, msg, ...) TGLog_eval_(TGLog_do_, tag, msg, ## __VA_ARGS__) | |
#define TGLog_eval_(macro, ...) macro(__VA_ARGS__) | |
#define TGLog_do_(tag, msg, ...) \ | |
(#tag[0] == 0 || #tag[0] == '1') ? NSLog(@"%@",[NSString stringWithFormat:msg, ## __VA_ARGS__]) : (void)0; |
import Cocoa | |
class foo { | |
var baz = false | |
func test() { | |
var bar: Int = 1 { | |
didSet { | |
if baz == true && bar == 2 { |
MUTHR:tmp teo$ ./test.sh | |
Note: checking out 'c79dddd'. | |
You are in 'detached HEAD' state. You can look around, make experimental | |
changes and commit them, and you can discard any commits you make in this | |
state without impacting any branches by performing another checkout. | |
If you want to create a new branch to retain commits you create, you may | |
do so (now or later) by using -b with the checkout command again. Example: |
let methodStart = NSDate() | |
/* ... Do whatever you need to do ... */ | |
let methodFinish = NSDate() | |
let executionTime = methodFinish.timeIntervalSinceDate(methodStart) | |
println("executionTime = \(executionTime)") |
let sema = dispatch_semaphore_create(0) | |
dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{ | |
// Do async stuff | |
// When finished, signal to continue below. | |
dispatch_semaphore_signal(sema) | |
} | |
// Wait for the load to complete. | |
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER) |
import Cocoa | |
protocol ThingId { } | |
protocol Thing { | |
func getId<A: ThingId>() -> A | |
} | |
struct MyThingId: ThingId { } |
import Cocoa | |
protocol ThingId { } | |
protocol Thing { | |
typealias IdType | |
func getId() -> IdType | |
} | |
struct MyThingId: ThingId { } |
/// Utilities for (eventually) dealing with | |
/// To be able to map a dictionary we extend it (from thoughtbot/Argo project) | |
// pure merge for Dictionaries | |
func + <T, U>(var lhs: [T: U], rhs: [T: U]) -> [T: U] { | |
for (key, val) in rhs { | |
lhs[key] = val /// Potential loss: Same key will lose existing lhs value. | |
} | |