Skip to content

Instantly share code, notes, and snippets.

View nlenepveu's full-sized avatar

Nicolas Lenepveu nlenepveu

View GitHub Profile
@nlenepveu
nlenepveu / gist:1905011
Created February 25, 2012 01:03
Webserver benchmark - empty.gif
; Node.js 0.6.11
ab -n 1000 -c 10 -s http://nodejs.localhost:9999/
Requests per second: 1007.72 [#/sec] (mean)
Time per request: 9.923 [ms] (mean)
Time per request: 0.992 [ms] (mean, across all concurrent requests)
; Apache 2.2, file system
ab -n 1000 -c 10 -s http://bench.localhost/empty.gif
@nlenepveu
nlenepveu / gist:1905060
Created February 25, 2012 01:09
Node.js empty.gif
var http = require('http');
var fs = require('fs');
var image = fs.readFileSync('empty.gif');
http.createServer(function(request, response){
response.writeHead(200, {'Content-Type': 'image/gif'});
response.end(image);
}).listen(9999);
@nlenepveu
nlenepveu / gist:2018246
Created March 11, 2012 21:20
Mass virtual hosts with Nginx for Zend Framework applications
server {
# Make sites accessible from http://$sub.localhost/
server_name ~^(?P<sub>.+)\.localhost$;
root /var/www/vhosts/$sub/public;
location ~* ^.+.(css|js|jpeg|jpg|gif|png|ico) {
expires 30d;
}
@nlenepveu
nlenepveu / gist:2029268
Created March 13, 2012 14:55
Model abstraction - class App_Model_Abstract
<?php
abstract class App_Model_Abstract
{
/**
* @var App_Model_AbstractMapper
*/
protected $_mapper;
/**
@nlenepveu
nlenepveu / gist:2029272
Created March 13, 2012 14:56
Model abstraction - class App_Model_AbstractMapper
<?php
abstract class App_Model_AbstractMapper
{
/**
* @var Zend_Db_Table_Abstract
*/
private $_dbTable;
/**
$ diff Gemfile.rails40 Gemfile
--- Gemfile.rails40 2014-04-02 12:43:11.810808902 +0200
+++ Gemfile 2014-04-02 11:19:02.754890760 +0200
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-gem 'rails', '4.0.4'
+gem 'rails', '3.2.17'
gem 'rake', '0.9.6'
gem 'net-sftp'