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
# enter your gemset below | |
rvm ruby-1.9.2-p180@eyd | |
# no need to edit below here | |
alias rails="bundle exec rails" | |
alias specjour="bundle exec specjour" | |
alias rspec="bundle exec rspec" | |
alias rake="bundle exec rake" | |
_VIM=$(which vim) |
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
# This function will pull an .rvmrc from a gist and place it in a directory | |
# Add this function to /home/username/.rvmrc | |
# | |
# usage: setup_rvmrc gemset /path/to/application/ | |
# example setup_rvmrc 1.9.2@app /var/www/app/ | |
# | |
# NOTE: The trailing slash on the path is important. | |
function setup_rvmrc() { | |
_REPO="git://gist.github.com/1080580.git" |
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
##################### | |
# ssh-agent stuff # | |
##################### | |
# get the ssh agent started | |
SSH_ENV="$HOME/.ssh/environment" | |
function start_agent { | |
echo "Initialising new SSH agent..." | |
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" | |
echo succeeded |
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
#!/bin/bash | |
# Pass in a csv file from STDIN as follows. No spaces. | |
# | |
# pattern,substitution | |
# pattern,substitution | |
if ! [ -t 0 ]; then | |
STDIN=`cat /dev/stdin` | |
fi |
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
#!/usr/bin/env php | |
<?php | |
// set some server variables so Drupal doesn't freak out | |
$_SERVER['SCRIPT_NAME'] = '/views'; | |
$_SERVER['SCRIPT_FILENAME'] = '/views'; | |
$_SERVER['HTTP_HOST'] = 'example.com'; | |
$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; | |
$_SERVER['REQUEST_METHOD'] = 'POST'; |
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
wp-content/uploads/ | |
wp-conten/files_mf/ | |
stats/ | |
wp-config.php | |
sitemap.xml | |
*.gz | |
*.sql | |
*.mysql | |
*.zip |
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 the map below to .vimrc as one long line. | |
" Restart vim, open horribly formatted css, press F9 | |
" Then gg=G to fix formatting | |
" Win. | |
map <F9> :%s/\n\+\s*//g<CR>:%s/:[ ]*/:/g<CR>:%s/}/}\r\r/g<CR>:%s/;/;\r\t/g<CR>:%s/[ ]*{/ {\r\t/g<CR>:%s/\(\t\)\?\/\*\(.*\)\*\//\1\/\*\r\1\2\r\1\*\/\r\1/ge<CR>:%s/\(\t\)\?\/\*/\1\/\*\r\1/ge<CR>:%s/\(\n\+\)\?\(\t\)\?\*\//\r\2\*\/\r\2\1\2/ge<CR>:%s/^\t}/}/g<CR>:%s/\t\([^:]\+\):/\t\1: /g<CR>:%s/[ ]*!important/ !important/ge<CR>:%s/\t\n//ge<CR>:%s/\n\{3,\}/\r\r/ge<CR>:%s/\(\n^$\)\{2,\}//ge<CR>:let err=0<CR>:while err == 0<CR>try<CR> %s/^\([^,\t]\+\),\([^$]\)/\1,\r\2/g<CR>catch /^Vim\%((\a\+)\)\=:E/<CR>endtry<CR>:endwhile<CR>gg=G<CR> | |
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
def strip_tags(text) | |
return text.gsub(/<\/?[^>]*>/, "") | |
end | |
def text_trim(text, len, trail = '...') | |
if len < text.size then | |
text.scan(/.{1,#{len}} /) do |match| | |
return match.rstrip + trail | |
break | |
end |
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
#!/bin/bash | |
# MAKE A BACKUP OF THE SITE! | |
# change directory to webroot | |
cd /var/www/hackedwordpresssite.com/html | |
# Get a list of files that contain the string "god_mode_off" and save it to a file | |
# command switches may differ depending on linux release | |
find . -type f -iname "*.php" | xargs -I{} grep -il god_mode_off {} > bad.list |
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
<?php | |
function custom_url_rewrite_outbound(&$path, &$options, $original_path) { | |
global $base_url; | |
if (strstr($base_url, 'https')) { | |
switch (true) { | |
case ((bool) strstr($path, 'cart/checkout')): | |
case ((bool) strstr($path, 'uc_js_util')): | |
case ((bool) strstr($path, 'admin_menu')): | |
$options['base_url'] = str_replace('http','https',$options['base_url']); | |
break; |
OlderNewer