This file contains hidden or 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
//I refactored this to except a parameter, as I would like to parse many URI Queries | |
function parseQueryString(query) { | |
//let's use an object, arrays aren't always the best for Key Value Pairs IMHO | |
var query_string = {}; | |
//original code didn't take in params. | |
//use "window.location.search.substring(1)" to get the current URI request. | |
//this splits each Key Value pair by the "&" seperator | |
var vars = query.split("&"); | |
This file contains hidden or 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
<?php | |
function encode_web_display_url($url_to_encode){ | |
if ($url_to_encode){ | |
//boom | |
$request = explode('/',urldecode($_SERVER['REQUEST_URI'])); | |
//loop | |
foreach($request as $request_slice){ | |
if (is_numeric($request_slice)){ | |
//convert |
This file contains hidden or 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
gem list | cut -d " " -f1 | xargs sudo gem uninstall -aIx |
This file contains hidden or 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
SELECT | |
CAST(DATEDIFF(d, GETDATE(), GETDATE()+1) AS VARCHAR) + ':' + | |
CAST(DATEDIFF(hh, GETDATE(), GETDATE()+1) AS VARCHAR) + ':' + | |
CAST(DATEDIFF(mi, GETDATE(), GETDATE()+1) AS VARCHAR) + ':' + | |
CAST(DATEDIFF(ss, GETDATE(), GETDATE()+1) AS VARCHAR) | |
--"d" will give you difference in Days | |
--"hh" will give you difference in Hours | |
--"mi" will give you difference in Minutes | |
--"ss" will give you difference in Seconds. |
This file contains hidden or 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
namespace :db do | |
desc "load user data from csv" | |
task :load_csv_data => :environment do | |
require 'fastercsv' | |
FasterCSV.foreach("data.csv") do |row| | |
User.create( | |
:user_name => row[0], | |
:email => row[1], |
This file contains hidden or 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
(function (isStorage) { | |
if (!isStorage) { | |
var data = {}, | |
undef; | |
window.localStorage = { | |
setItem : function(id, val) { return data[id] = String(val); }, | |
getItem : function(id) { return data.hasOwnProperty(id) ? data[id] : undef; }, | |
removeItem : function(id) { return delete data[id]; }, | |
clear : function() { return data = {}; } | |
}; |
This file contains hidden or 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
cd ~/Downloads | |
sudo apt-get update | |
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev | |
git clone git://github.com/ariya/phantomjs.git | |
cd phantomjs | |
git checkout 1.9 | |
./build.sh |
This file contains hidden or 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
apt-get update | |
apt-get -y install rpcbind nfs-common | |
apt-get -y install libfontconfig | |
apt-get -y install squid3 | |
mkdir /import | |
#mount -t nfs -o proto=tcp,port=2049 export.domain.com:/export /import | |
mv /etc/squid3/squid.conf squid.conf | |
apt-get -y install apache2-utils | |
apt-get -y install git | |
wget http://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2 |
This file contains hidden or 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
sudo apt-get install imagemagick librmagick-ruby |