-
-
Save knowtheory/2accf4151d6cdd07fe7e to your computer and use it in GitHub Desktop.
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
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from Thin | |
Thin web server (v1.6.2 codename Doc Brown) | |
Maximum connections set to 1024 | |
Listening on localhost:4567, CTRL+C to stop | |
{} | |
127.0.0.1 - - [05/Jun/2014 09:59:55] "POST /endpoint HTTP/1.1" 200 - 0.0066 | |
{"1"=>16, "2"=>17, "3"=>11, "4"=>13, "5"=>15, "6"=>11, "7"=>12, "8"=>11, "9"=>12, "10"=>15} | |
127.0.0.1 - - [05/Jun/2014 10:00:25] "POST /endpoint HTTP/1.1" 200 - 0.0019 | |
{"1"=>18, "2"=>16, "3"=>19, "4"=>14, "5"=>16, "6"=>18, "7"=>17, "8"=>12, "9"=>13, "10"=>12} | |
127.0.0.1 - - [05/Jun/2014 10:00:55] "POST /endpoint HTTP/1.1" 200 - 0.0009 | |
{"1"=>15, "2"=>11, "3"=>15, "4"=>19, "5"=>12, "6"=>21, "7"=>15, "8"=>15, "9"=>17, "10"=>12} | |
127.0.0.1 - - [05/Jun/2014 10:01:25] "POST /endpoint HTTP/1.1" 200 - 0.0015 | |
{"1"=>19, "2"=>16, "3"=>16, "4"=>15, "5"=>12, "6"=>15, "7"=>14, "8"=>15, "9"=>10, "10"=>15} | |
127.0.0.1 - - [05/Jun/2014 10:01:55] "POST /endpoint HTTP/1.1" 200 - 0.0013 | |
{"1"=>14, "2"=>12, "3"=>12, "4"=>11, "5"=>14, "6"=>11, "7"=>17, "8"=>17, "9"=>17, "10"=>16} | |
127.0.0.1 - - [05/Jun/2014 10:02:25] "POST /endpoint HTTP/1.1" 200 - 0.0009 | |
{"1"=>13, "2"=>14, "3"=>12, "4"=>16, "5"=>16, "6"=>18, "7"=>14, "8"=>15, "9"=>11, "10"=>11} | |
127.0.0.1 - - [05/Jun/2014 10:02:55] "POST /endpoint HTTP/1.1" 200 - 0.0006 | |
{"1"=>5, "2"=>12, "3"=>12, "4"=>12, "5"=>15, "6"=>6, "7"=>11, "8"=>13, "9"=>15, "10"=>13} | |
127.0.0.1 - - [05/Jun/2014 10:03:25] "POST /endpoint HTTP/1.1" 200 - 0.0012 | |
{"2"=>2, "3"=>3, "8"=>2, "9"=>5, "10"=>6} |
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
--- flushed --- | |
16: 1 | |
17: 2 | |
11: 3 | |
13: 4 | |
15: 5 | |
11: 6 | |
12: 7 | |
11: 8 | |
12: 9 | |
15: 10 | |
--- flushed --- | |
18: 1 | |
16: 2 | |
19: 3 | |
14: 4 | |
16: 5 | |
18: 6 | |
17: 7 | |
12: 8 | |
13: 9 | |
12: 10 | |
--- flushed --- | |
15: 1 | |
11: 2 | |
15: 3 | |
19: 4 | |
12: 5 | |
21: 6 | |
15: 7 | |
15: 8 | |
17: 9 | |
12: 10 | |
--- flushed --- | |
19: 1 | |
16: 2 | |
16: 3 | |
15: 4 | |
12: 5 | |
15: 6 | |
14: 7 | |
15: 8 | |
10: 9 | |
15: 10 | |
--- flushed --- | |
14: 1 | |
12: 2 | |
12: 3 | |
11: 4 | |
14: 5 | |
11: 6 | |
17: 7 | |
17: 8 | |
17: 9 | |
16: 10 | |
--- flushed --- | |
13: 1 | |
14: 2 | |
12: 3 | |
16: 4 | |
16: 5 | |
18: 6 | |
14: 7 | |
15: 8 | |
11: 9 | |
11: 10 | |
--- flushed --- | |
5: 1 | |
12: 2 | |
12: 3 | |
12: 4 | |
15: 5 | |
6: 6 | |
11: 7 | |
13: 8 | |
15: 9 | |
13: 10 | |
--- flushed --- | |
2: 2 | |
3: 3 | |
2: 8 | |
5: 9 | |
6: 10 |
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
posts = [{"1"=>16, "2"=>17, "3"=>11, "4"=>13, "5"=>15, "6"=>11, "7"=>12, "8"=>11, "9"=>12, "10"=>15}, | |
{"1"=>18, "2"=>16, "3"=>19, "4"=>14, "5"=>16, "6"=>18, "7"=>17, "8"=>12, "9"=>13, "10"=>12}, | |
{"1"=>15, "2"=>11, "3"=>15, "4"=>19, "5"=>12, "6"=>21, "7"=>15, "8"=>15, "9"=>17, "10"=>12}, | |
{"1"=>19, "2"=>16, "3"=>16, "4"=>15, "5"=>12, "6"=>15, "7"=>14, "8"=>15, "9"=>10, "10"=>15}, | |
{"1"=>14, "2"=>12, "3"=>12, "4"=>11, "5"=>14, "6"=>11, "7"=>17, "8"=>17, "9"=>17, "10"=>16}, | |
{"1"=>13, "2"=>14, "3"=>12, "4"=>16, "5"=>16, "6"=>18, "7"=>14, "8"=>15, "9"=>11, "10"=>11}, | |
{"1"=>5, "2"=>12, "3"=>12, "4"=>12, "5"=>15, "6"=>6, "7"=>11, "8"=>13, "9"=>15, "10"=>13}, | |
{"2"=>2, "3"=>3, "8"=>2, "9"=>5, "10"=>6}] | |
posts.reduce({}){ |acc, hsh| hsh.each{ |k,v| acc[k] ||= 0; acc[k] += v }; acc } # => {"1"=>100, "2"=>100, "3"=>100, "4"=>100, "5"=>100, "6"=>100, "7"=>100, "8"=>100, "9"=>100, "10"=>100} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment