Skip to content

Instantly share code, notes, and snippets.

View roelven's full-sized avatar

Roel van der Ven roelven

View GitHub Profile
@roelven
roelven / gist:733491
Created December 8, 2010 16:18
transfer a whole dir from one server to another
## transfer a whole dir from one server to another
##
scp -P 31415 -r /var/www/vhosts/roelvanderven.com/subdomains/dump/httpdocs/* [email protected]:/usr/local/www/dump/
@roelven
roelven / gist:718811
Created November 28, 2010 10:47
Print the sanitized page title as #id in the body tag:
//
// I don't like logic in views / template files.
// Here's a first attempt of nicely identifying your pages by page titles.
//
// Yes, I know Wordpress' body_class() does something similar,
// but I like semantics and readable code.
//
// Put this in your functions.php:
// Print the sanitized page title as #id in the body tag:
@roelven
roelven / gist:711865
Created November 23, 2010 14:47
Install rvm
mkdir -p ~/.rvm/src/ && cd ~/.rvm/src && rm -rf ./rvm/ && git clone --depth 1 git://github.com/wayneeseguin/rvm.git && cd rvm && ./install
@roelven
roelven / gist:711818
Created November 23, 2010 14:15
My .profile
##
## My .profile file.
## Replace Roel with your own username!
##
export PS1='\u@\h:\w $(vcprompt)\$ '
export PATH=/usr/local/sbin:$PATH
export CDPATH=/Users/Roel/Sites
##
@roelven
roelven / gist:663332
Created November 4, 2010 22:44
Sort amount of results per city in mysql
SELECT `plaats`, count(*) AS `Number`
FROM `kijkmijnhuis`
GROUP BY `plaats`
ORDER BY `Number` DESC
LIMIT 20;
@roelven
roelven / gist:663124
Created November 4, 2010 20:23
Parse .eml files to retrieve emailaddresses
##
## Parse a whole directory of .eml files
## and retrieve all printed emailaddresses, sort them, and remove duplicates
## and print to a file.
##
perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}' *.* | sort -u > /tmp/output.txt
@roelven
roelven / gist:660977
Created November 3, 2010 11:13
Awesome git functions to check differentiation between branches
##
## Add awesome git functions to check differentiation between branches.
## Add this to your ~/.profile and reload with $ source ~/.profile
##
## See http://stackoverflow.com/questions/53569/how-to-get-the-changes-on-a-branch-in-git
##
function parse_git_branch {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
@roelven
roelven / gist:660935
Created November 3, 2010 10:19
Sendmail function with SwiftMailer
function sendMail($subject, $body, $receiver) {
$sender = array('[email protected]' => 'Inzetkast.nl');
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
->setUsername('[email protected]')
->setPassword('xxxx')
;
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance($subject)
@roelven
roelven / more_clientapplications
Created October 14, 2010 15:30
Create extra ClientApplications on dev environment
# Create extra ClientApplications on dev environment
# Run in script/console
#
# Thanks Johan!
ClientApplication.all.each { |app| AccessToken.create(:user_id => 303477976, :client_application_id => app.id, :authorized_at => Time.now) }
@roelven
roelven / gist:602761
Created September 29, 2010 13:44
DataURIze all images in a dir with PHP
<?php
/*
- Check folder images for available images files (I used gif only in this case)
- Loop through all images and render them inline in HTML, using dataURI's with Base64 encoding through PHP
- View the output in your browser to get the encoded strings
*/