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
$.ajax( { | |
url: 'http://localhost:3000/save', | |
data: r, | |
type: 'GET', | |
success: function(response) { | |
console.log('SUCCESS', response); | |
}, | |
error: function(xhr, status, message) { | |
console.log('ERROR', status, message); | |
} |
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
var express = require('express'); | |
var app = express(); | |
var app2 = express(); | |
app.use(express.vhost('app1.example.com', require('./app1').app)); | |
app.use(express.vhost('app2.example.com', app2)); | |
app2.get('/', function(req, res) { | |
res.send('app 2'); |
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
var express = require('express') | |
, sass = require('node-sass') | |
, http = require('http') | |
, path = require('path'); | |
var app = express(); | |
app.configure(function(){ | |
app.set('port', process.env.PORT || 3000); | |
app.set('views', __dirname + '/views'); |
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
html | |
head | |
body | |
h1= title | |
!{form} |
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
urlConfig = [ | |
["/", (req, res) -> | |
console.log(req.url) | |
res.send "hello world" | |
] | |
] | |
module.exports = urlConfig |
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
var a = [ 'a', 'b', 'c' ]; | |
var b = []; | |
for (var i in a) { | |
b[i] = function() { console.log('i', i, 'a[i]', a[i]) }; | |
}; | |
b.forEach(function(v) { v() }); | |
b = []; |
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
# Module dependencies. | |
express = require 'express' | |
http = require 'http' | |
path = require 'path' | |
colors = require 'colors' | |
engines = require 'consolidate' | |
engine = 'hogan' | |
app = express() |
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
# both tested with: httperf --hog --server 127.0.0.1 --port 8012 --num-conn 100 --num-calls 100 | |
# gunicorn -k gevent -b 0.0.0.0:8012 app:application | |
def application(environ, start_response): | |
status = '200 OK' | |
res = "Hello world!" | |
response_headers = [ | |
('Content-type','text/plain'), | |
('Content-Length',str(len(res)))] | |
start_response(status, response_headers) |
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
#!/usr/bin/env python | |
import multiprocessing, sys, random, time | |
def process_file(filename, foo, bar, baz='biz'): | |
print "FOO" | |
if random.random() < 0.5: | |
raise Exception("blah") | |
return 123 |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <signal.h> | |
#include <netdb.h> | |
#include <string.h> | |
#include <netinet/in.h> | |
#include <X11/X.h> | |
#include <X11/Xlib.h> | |
#include <X11/Intrinsic.h> | |
#include <X11/StringDefs.h> |