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
const | |
util = require('util'), | |
net = require('net'); | |
var sendBug = process.argv[2] == '-bug'; | |
var socket = net.createConnection(8001).on('connect', function(){ | |
util.log('Connected to server'); | |
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
const | |
util = require('util'), | |
net = require('net'), | |
crypto = require('crypto'), | |
fs = require('fs'), | |
Buffer = require('buffer').Buffer, | |
http = require('http'), | |
url = require('url'); | |
var privateKey = fs.readFileSync('../cert/privatekey.pem').toString(); |
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
toObject = (item) -> | |
return item unless item.toObject | |
json = item.toObject() | |
for key, val of json | |
if _.isArray val | |
json[key] = _.map val, (element) -> toObject element | |
else |
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 ( | |
"net/http" | |
"log" | |
"fmt" | |
) | |
func main() { | |
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { |
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
go and node running on MacOS Lion, i7, 8GB RAM. | |
ab running on linux in a VirtualBox (on the same machine). | |
Script source code: | |
https://gist.github.com/2722169 | |
ab command line: | |
ab -n 40000 -c 200 -r 192.168.1.104:1337/ | |
Test results: |
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
superSum = (k, n) -> | |
sum = n | |
sum = (sum * (n + i)) / (i + 1) for i in [1..k] | |
sum | |
console.log 'superSum(1,3)=', superSum(1, 3) | |
console.log 'superSum(2,3)=', superSum(2, 3) | |
console.log 'superSum(10,10)=', superSum(10,10) | |
console.log 'superSum(20,20)=', superSum(20,20) |
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
;Source map: | |
{ | |
"key1" {name: "some1" dependencies: ["dep1" "dep2" "dep3"]} | |
"key2" {name: "some2" dependencies: ["dep4" "dep3"]} | |
;and so on | |
} | |
; I want to get to this | |
{ | |
"key1" {name: "some1" dependencies: ["mapped dep1" "mapped dep2" "mapped dep3"]} |
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
└─ express@4.13.3 | |
├─ array-flatten@1.1.1 | |
├─ cookie-signature@1.0.6 | |
├─ debug@2.2.0 | |
│ └─ ms@0.7.1 | |
├─ depd@1.0.1 | |
├─ accepts@1.2.12 | |
│ ├─ negotiator@0.5.3 | |
│ └─ mime-types@2.1.4 | |
│ └─ mime-db@1.16.0 |
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
All data is contained in one big file, for example: | |
http://www.boomhub.org/db/results.json | |
All the nodes are stored in the root of the json, with the url paths as keys. | |
Each node has a "type" field. | |
Type can be "section" or "article". | |
Section node | |
A section node has a "links" field, which is an array of "link" nodes. | |
Each link contains a "href" field, a imageURL and a title field. |
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
(ns helloserver | |
(:require [cljs.nodejs :as nodejs])) | |
(def http (nodejs/require "http")) | |
(-> (.createServer http (fn [req res] | |
(doto res | |
(.writeHead 200 {"Content-Type" "text/plain"}) | |
(.end "Hello from ClojureScript")))) | |
(.listen 8080 "127.0.0.1")) |
OlderNewer