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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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 | |
$properties = array( | |
'y' => 'years', | |
'm' => 'years', | |
'd' => 'years', | |
'h' => 'years', | |
'i' => 'years', | |
's' => 'years', | |
); |
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
// via http://stackoverflow.com/questions/6677035/jquery-scroll-to-element | |
$('html,body').animate({ scrollTop: $('#target').offset().top }, 500) |
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
var years = {}; | |
$('.blog-sidebar .widget_archive a').each(function () { | |
var year = this.innerHTML.match(/\d{4}/)[0]; | |
if (!years[year]) years[year] = []; | |
years[year].push(this); | |
}); | |
_.each(years, function (links, year) { | |
var li = $('<li/>'), a = $('<a/>'), ul = $('<ul/>'); |
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 | |
header('Content-type: text/plain'); | |
print_r($_REQUEST); | |
exit; |
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
#!/bin/bash | |
git push $1 +HEAD:master | |
git fetch $1 | |
git push origin --tags |
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
#!/bin/sh | |
# Receive <oldrev> <newrev> <refname> | |
read oldrev newrev refname | |
# The darget of the deployment | |
target=/var/www/vhosts/www.example.com | |
echo Deploying to $target | |
echo ======================================================= |
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
git tag deployment-`date +'%Y%m%d%H%M%S'` |
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 /path/to/Example | |
scp [email protected]:production.sql | |
mysql -u root dev_example < production.sql | |
mysql -u root dev_example <<< 'UPDATE wp_options SET option_value = "http://example.local" WHERE option_name IN ("home","siteurl")' | |
rm production.sql | |
scp [email protected]:uploads.tgz . | |
tar -xvzf uploads.tgz | |
rm uploads.tgz |
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
// http://jsfiddle.net/6R5Ea/3/ | |
// App Namespace | |
(function ($j, $u, $b) { | |
var App = window.app = {}; | |
})(window.jQuery, window._, window.Backbone); | |
// Zip Locater Application | |
// ======================= | |
(function ($j, $u, $b) { |