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
/** | |
* European Energy Label in CSS | |
*/ | |
.energy-class { | |
position: relative; | |
width: 155px; | |
font-family : sans-serif; | |
} | |
.energy-class span { |
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
import re | |
# functions to detect/fix double-encoded UTF-8 strings | |
# Based on http://blogs.perl.org/users/chansen/2010/10/coping-with-double-encoded-utf-8.html | |
DOUBLE_ENCODED = re.compile(""" | |
\xC3 (?: [\x82-\x9F] \xC2 [\x80-\xBF] # U+0080 - U+07FF | |
| \xA0 \xC2 [\xA0-\xBF] \xC2 [\x80-\xBF] # U+0800 - U+0FFF | |
| [\xA1-\xAC] \xC2 [\x80-\xBF] \xC2 [\x80-\xBF] # U+1000 - U+CFFF | |
| \xAD \xC2 [\x80-\x9F] \xC2 [\x80-\xBF] # U+D000 - U+D7FF | |
| [\xAE-\xAF] \xC2 [\x80-\xBF] \xC2 [\x80-\xBF] # U+E000 - U+FFFF |
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> |
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 app = require('express')() | |
, server = require('http').createServer(app) | |
, io = require('socket.io').listen(server); | |
server.listen(3012); | |
app.get('/', function (req, res) { | |
res.sendfile(__dirname + '/index.html'); | |
}); |
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
// First: create an index.html in the same directory, and try retrieving it | |
// via http://localhost:3012/ ; instead, you'll get the 'catchall' response. | |
// This is because the code below is equivalent to: | |
// | |
// app.use(app.router); <-- which *also* handles the catch-all | |
// app.use(express.static()); <-- never reached because the router caught it | |
// | |
var express = require('express'); | |
var 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
var express = require('express'); | |
var app = express(); | |
app.use(express.static(__dirname)); | |
app.get('/search', function(req, res){ | |
res.send({ hello : 'world' }); | |
}); | |
app.listen(3012); |
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
app.use(function(req, res, next) { | |
if (req.method === 'HEAD') { | |
res.on('finish', function() { | |
req.connection.end(); | |
}); | |
} | |
next(); | |
}); |
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
public class Test { | |
public static void main(String[] args) { | |
long heapMaxSize = Runtime.getRuntime().maxMemory(); | |
System.out.println("Max: " + heapMaxSize); | |
} | |
} |
NewerOlder