This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import( | |
"time" | |
"log" | |
"sync" | |
) | |
func main() { | |
var wg sync.WaitGroup | |
wg.Add(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type Node struct { | |
Data string | |
Left *Node | |
Right *Node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MultiContext allows you to use multiple contexts for cancellation | |
// allowing for sibling relationship, as well as parent-child relationship. | |
// This is an experiment, and likely not a good approach. | |
type MultiContext struct { | |
ctxs []context.Context | |
done chan struct{} | |
err error | |
} | |
func NewMultiContext(ctxs []context.Context) *MultiContext { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
type Iface interface { | |
Method() | |
} | |
type Inner struct { | |
Iface | |
} | |
type Outer struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function EventEmitter() { | |
EventEmitter.init.call(this); | |
} | |
/*...*/ | |
EventEmitter.init = function() { | |
this.domain = null; | |
if (EventEmitter.usingDomains) { | |
// if there is an active domain, then attach to it. | |
domain = domain || require('domain'); | |
if (domain.active && !(this instanceof domain.Domain)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function EventEmitter() { | |
this.domain = null; | |
if (exports.usingDomains) { | |
// if there is an active domain, then attach to it. | |
domain = domain || require('domain'); | |
if (domain.active && !(this instanceof domain.Domain)) { | |
this.domain = domain.active; | |
} | |
} | |
this._events = this._events || {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface UIView (Inspectable) | |
@property (nonatomic) IBInspectable CGFloat cornerRadius; | |
@property (nonatomic) IBInspectable BOOL circular; | |
@property (nonatomic) IBInspectable CGFloat shadowRadius; | |
@property (nonatomic) IBInspectable CGFloat shadowOpacity; | |
@property (nonatomic) IBInspectable CGSize shadowOffset; |