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" | |
"math/rand" | |
"time" | |
) | |
type Cc struct { | |
name string |
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" | |
"math/rand" | |
"time" | |
) | |
type Acc struct { | |
name string |
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" | |
"log" | |
"math/rand" | |
"time" | |
) | |
type Snapshot 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
cespinoza@xanadu ~ $ ab -n 100000 -c 1000 -t 1 -k -g out.dat http://127.0.0.1:3000/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 127.0.0.1 (be patient) | |
Finished 3907 requests | |
Server Software: Jetty(7.6.1.v20120215) |
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
cespinoza@xanadu ~ $ ab -n 100000 -c 1000 -t 1 -k -g out.dat http://127.0.0.1:9000/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 127.0.0.1 (be patient) | |
Finished 1034 requests | |
Server Software: |
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
cespinoza@xanadu ~ $ ab -n 100000 -c 1000 -t 1 -k -g out.dat http://127.0.0.1/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 127.0.0.1 (be patient) | |
Finished 166 requests | |
Server Software: Apache/2.2.22 |
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
// Given a query string "?to=email&why=because&first=John&Last=smith" | |
// getUrlVar("to") will return "email" | |
// getUrlVar("last") will return "smith" | |
// Slightly more concise and improved version based on http://www.jquery4u.com/snippets/url-parameters-jquery/ | |
function getUrlVar(key){ | |
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search); | |
return result && unescape(result[1]) || ""; | |
} |
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
(defn make-greetings | |
[hello] | |
{:pre [(string? hello) (< (count hello) 10)] ; pre-validation guards | |
:post [(string? %)]} ; result validation | |
(fn [name] | |
(str hello " " name "!"))) |
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
// Playing with functions | |
// This is really useful | |
package main | |
import "fmt" | |
func greet() { | |
fmt.Println("Hello!") | |
} | |
func farewell() { |
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 ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"time" | |
) | |
type User struct { |