View clickable.js
This file contains 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
/* Clickable elements | |
*/ | |
// when any .clickable elem is clicked, we'll grab the first link in the elem and redirect to it. | |
$('body').on('click', '.clickable', function(e){ | |
var link = $('a:first', this) | |
, href = link.attr('href') | |
// _blank, command key, ctrl key, middle click | |
if (link.attr('target') == '_blank' || e.metaKey || e.ctrlKey || e.which == 2) | |
window.open(href, '_blank') |
View bash_tolf.sh
This file contains 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
alias tolf="find . -type f -not -iname '*.png' -not -iname '*.jpg' -not -iname '*.jpeg' -not -iname '*.gif' -not -iname '*.tif' -not -iname '*.tiff' -not -iname '.git' -exec perl -pi -e 's/\r\n?/\n/g' {} \;" |
View strtotitle
This file contains 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
# converts a string to title case | |
# input: string | |
# output: string in title case | |
function strtotitle($title) { | |
$blacklist = array( 'of','a','the','and','an','or','nor','but','is','then','else', 'at','from','by','on','off','for','in','out','over','to','into','with' ); | |
$words = explode(' ', $title); | |
foreach ($words as $key => $word) { | |
if ($key == 0 || !in_array($word, $blacklist)) | |
$words[$key] = ucfirst($word); | |
} |
View gitinstall.sh
This file contains 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
# add this to your .bash_profile | |
# usage: gitinstall http://github.com/path/to/git.git | |
function gitinstall(){ git init; git remote add origin "$@"; git config branch.master.remote origin; git config branch.master.merge refs/heads/master; git pull;} |
View newdjango.sh
This file contains 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
# To setup a new django project | |
virtualenv PROJECTNAME --no-site-packages | |
source PROJECTNAME/bin/activate | |
pip install django | |
django-admin.py startproject PROJECTNAME | |
python PROJECTNAME/manage.py runserver |
View tolf.sh
This file contains 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
find . -type f -not -iname '*.png' -not -iname '*.jpg' -not -iname '*.jpeg' -not -iname '*.gif' -not -iname '*.tif' -not -iname '*.tiff' -not -iname '.git' -exec perl -pi -e 's/\r\n?/\n/g' {} \; |
View batchrename.sh
This file contains 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
ls mx50_* | awk '{print("mv "$1" "$1)}' | sed s/mx50_*/buckminster_/2 | /bin/sh |
View gist:2654948
This file contains 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
/* | |
Copyright (c) 2010, Patrick Wied. All rights reserved. | |
Code licensed under the BSD License: | |
http://patrick-wied.at/static/license.txt | |
*/ | |
var heatmapApp = (function(){ | |
// var definition | |
// canvas: the canvas element | |
// ctx: the canvas 2d context | |
// width: the heatmap width for border calculations |
View gist:2654956
This file contains 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
<!doctype html> | |
<title>Image-free spinner</title> | |
<style> | |
@-webkit-keyframes fadeOut { | |
0% { opacity:1; } | |
100% { opacity:.1; }} | |
p { | |
position:absolute; | |
overflow:hidden; | |
top:50%; |
View .htaccess
This file contains 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
<files wp-config.php> | |
order allow,deny | |
deny from all | |
</files> | |
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] | |
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] | |
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) | |
RewriteRule ^(.*)$ index.php [F,L] |
OlderNewer