This file contains hidden or 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
type Timestamp time.Time | |
func (t *Timestamp) UnmarshalJSON(b []byte) error { | |
i, err := strconv.ParseInt(string(b[1:len(b)-1]), 10, 0) | |
if err != nil { | |
log.Println("Unable to parse timestamp from json") | |
} | |
*t = Timestamp(time.Unix(i, 0)) | |
return nil | |
} |
This file contains hidden or 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
type Timestamp time.Time | |
func (t *Timestamp) UnmarshalJSON(b []byte) error { | |
i, err := strconv.ParseInt(string(b[1:len(b)-1]), 10, 0) | |
if err != nil { | |
log.Println("Unable to parse timestamp from json") | |
} | |
*t = Timestamp(time.Unix(i, 0)) | |
return nil | |
} |
This file contains hidden or 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 ( | |
"log" | |
"bufio" | |
"encoding/json" | |
"net/http" | |
) | |
func main() { |
This file contains hidden or 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 ( | |
"bufio" | |
"log" | |
"net/rpc" | |
"os" | |
) | |
func main() { |
This file contains hidden or 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 core | |
import ( | |
"net/http" | |
) | |
// the Request struct wraps the http.Request struct, providing a slice of | |
// strings representing the positional arguments found in a url pattern, and a | |
// map[string]string called kwargs representing the named parameters captured | |
// in url parsing. |
This file contains hidden or 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
paramlist := map[string]params{ | |
"one": ¶ms{ ... }, | |
"two": ¶ms{ ... }, | |
"three": ¶ms{ ... }, | |
} | |
results := make(map[string]result, len(paramlist)) | |
for k, v := range paramlist { | |
wg.Add() | |
go func(label string, myparams param) { | |
defer wg.Done() |
This file contains hidden or 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 ( | |
"reflect" | |
"fmt" | |
) | |
func main() { | |
var x struct { | |
MyField int `core:"required"` |
This file contains hidden or 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 ( | |
"encoding/json" | |
"fmt" | |
"strings" | |
) | |
var ( | |
stream = ` |
This file contains hidden or 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" | |
"io" | |
"os" | |
) | |
type Tree struct { | |
Children []*Tree |
This file contains hidden or 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
class Foo(object): | |
def __init__(self): | |
self.x = 0 | |
def __repr__(self): | |
return "<Foo x:%d>" % self.x | |
def add_x(self, x): | |
self.x += x |