Tuesday, September 25, 2012

vertically center content in bootstrap

This is how you vertically center stuff in bootstrap:



This doesnt work in IE8 or less.

Monday, September 24, 2012

install syntax highlighter 3.x on blogger

To install syntax highligher on blogger here what you need to do:

Edit raw template html and put this after the HEAD tag:


and put this at the bottom of the template before the closing HTML tag: ]


NOTE:
If the javascript snippet above you must escape all html entities. They are shown as non-escaped becase of limitations of blogger. You will have to replace all of ' with @quot; and < with <

Monday, September 17, 2012

A/B Testing with nginx via rewrite

Here is how you can setup 50% of your users to see a different homepage via nginx.

We split them based on the last digit of their IP address:

location / {
    if ($remote_addr ~ "[02468]$") {
        rewrite ^(.+)$ /a$1 last;
    }
    rewrite ^(.+)$ /b$1 last;
}
location /a {
    alias   /Users/dogself/site;
    index  index.html index.htm;
    ssi    on;
}
location /b {
    alias   /Users/dogself/site;
    index  index2.html index2.htm;
    ssi    on;
}

The trick here is that instead of using the root directive you should use the alias directive. Using alias means that you dont need to create an 'a' and 'b' directories on your server for this to work.

The downside is that now you have /a/ and /b/ in your path. If you know a way around that, let me know!

How To Install Node.js on RasberryPi

This will let you install the latest version of node.js on a Raspberry Pi running occidentalis 0.2:


git clone https://github.com/joyent/node.git
cd node
export GYP_DEFINES="armv7=0"
export CXXFLAGS='-march=armv6 -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT'
export CCFLAGS='-march=armv6 -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT'
./configure --shared-openssl --without-snapshot
make
make install


Compiling node will take about 4-5 hours.

but at the end you will be rewarded with:

pi@raspberrypi ~ $ node --version
v0.9.2-pre