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
| // JSONResponseWriter wraps an http.ResponseWriter and provides convenience methods for creating JSON responses | |
| type JSONResponseWriter struct { | |
| writer http.ResponseWriter | |
| } | |
| // Response writes an HTTP response with the value v encoded in JSON format. | |
| func (w JSONResponseWriter) Response(v interface{}) { | |
| w.writer.Header().Set("Content-Type", "application/json") | |
| enc := json.NewEncoder(w.writer) | |
| enc.Encode(v) |
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 httphandlers | |
| import ( | |
| "net/http" | |
| ) | |
| type MethodHandler struct { | |
| handlers map[string]http.Handler | |
| } |
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
| for(item in Jenkins.instance.items) { | |
| println("job $item.name") | |
| prop = item.getProperty(ParametersDefinitionProperty.class) | |
| if(prop != null) { | |
| newdefs = prop.getParameterDefinitions().findAll{p -> p.name != "TEST_FFDB_ROOT" && p.name != "NODE_VERSION"} | |
| for(d in newdefs) { | |
| println("$d.name") | |
| } | |
| newprop = ParameterDefinitionProperty(newdefs) | |
| } |
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
| kyoto:mux kamil$ cat mux_test.diff | |
| diff --git a/mux_test.go b/mux_test.go | |
| index 19e0daf..158ce54 100644 | |
| --- a/mux_test.go | |
| +++ b/mux_test.go | |
| @@ -23,150 +23,126 @@ func TestRoute(t *testing.T) { | |
| return idValue | |
| } | |
| - // Host ------------------------------------------------------------------- |
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
| // An example of implementing Mozilla's Persona authentication system. | |
| // follows the instructions from https://developer.mozilla.org/en-US/docs/Persona/Quick_Setup | |
| // and doesn't do much else. | |
| package main | |
| import ( | |
| "encoding/json" | |
| "github.com/gorilla/mux" | |
| "github.com/gorilla/sessions" | |
| "html/template" |
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 arco | |
| import ( | |
| "database/sql" | |
| pq "github.com/bmizerany/pq" | |
| "time" | |
| ) | |
| type DB struct { | |
| db *sql.DB |
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 Executor struct { | |
| conn net.Conn | |
| } | |
| func NewExecutorDecoder(r io.Reader) ExecutorDecoder { | |
| d := ExecutorDecoder{} | |
| d.Messages = make(chan string) | |
| d.Decoder = gob.NewDecoder(r) | |
| return d | |
| } |
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
| var units = map[string]int{ | |
| "s": 1, | |
| "sec": 1, | |
| "secs": 1, | |
| "second": 1, | |
| "seconds": 1, | |
| "m": 60, | |
| "min": 60, | |
| "mins": 60, | |
| "minute": 60, |
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
| #!/usr/bin/env python | |
| import jsonrpclib | |
| s = jsonrpclib.Server('http://localhost:1234/rpc') | |
| s.Say('Kamil') |
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 ( | |
| "os" | |
| "os/exec" | |
| ) | |
| func main() { | |
| c := exec.Command("vim") | |
| c.Stdout = os.Stdout |