Skip to content

Instantly share code, notes, and snippets.

View olauzon's full-sized avatar

Olivier Lauzon olauzon

View GitHub Profile
12345678901234567890123456789012345678901234567890123456789012345678901234567890
00000000001111111111222222222233333333334444444444555555555566666666667777777777
@olauzon
olauzon / useragent_example.js
Created December 16, 2011 18:01
useragent module examples
var http = require('http'),
userAgent = require('useragent');
http.createServer(function (request, response) {
var userAgentString = request.headers['user-agent'],
ua_obj = userAgent.parse(userAgentString),
is = userAgent.is(userAgentString),
content = "";
# Array#join vs String#+
require 'benchmark'
n = 1_000_000
Benchmark.bm do |x|
x.report('Array#join :') {
n.times { ['this', 'is', 'a', 'test'].join(' ') }
}
x.report('String#+ :') {
# Set postgis-1.5 path.
$ POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-1.5
# Creating the template spatial database
$ createdb -E UTF8 -T template0 template_postgis
# and add PLPGSQL language support.
$ createlang -d template_postgis plpgsql
# Loading the PostGIS SQL routines.
$ psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql
@olauzon
olauzon / git-commit-prefixes
Created May 16, 2011 20:26 — forked from indexzero/git-commit-prefixes
Short list of Git commit prefixes used at Nodejitsu
[api]: New apis / changes to apis
[test]: Update test/* files
[dist]: Changes to submodules, version bumps, updates to package.json
[minor]: Small changes
[doc]: Updates to documentation
[ux]: Updates to UX
[fix]: Bug fixes
[bin]: Update binary scripts associated with the project
[merge]: Resolved git merge from upstream or otherwise
[refactor]: Refactor of existing code with no external API changes
#!/usr/bin/env ruby
# Place this script in your shell's load path
require 'rubygems'
begin
require 'highline/import'
rescue
puts "'sudo gem install highline' in your system Ruby"
end
# Generate .rvmrc file in a project directory
require 'autotest/redgreen'
# require 'autotest/pretty'
# require 'autotest/snarl'
# require 'autotest/timestamp'
module Autotest::Growl
def self.growl title, msg, img, pri=0, sticky=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}"
end