Skip to content

Instantly share code, notes, and snippets.

View rriveras's full-sized avatar

Roberto Rivera rriveras

View GitHub Profile
@draeton
draeton / anchor.js
Created January 9, 2012 15:15
Anchor - A URL parsing utility
/**
* Anchor - A URL parsing utility
*
* Copyright 2012, Matthew Cobbs
* MIT licensed
*
* Methods:
*
* getSearchVars - returns a key-value object with the parameters in the URL search
* setSearchVars(o) - sets parameters using a key-value object in the URL search
# Dev enviroment
echo sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true | debconf-set-selections
sudo apt-get install memcached subversion libxslt-dev libxml2-dev imagemagick libmagickcore-dev mysql-server libmysqlclient-dev -y
# Install Rubygems
cd /usr/local/src
sudo wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.tgz
sudo tar xzvf rubygems-1.3.6.tgz
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);