Skip to content

Instantly share code, notes, and snippets.

@tony4d
tony4d / php-lint-git.sh
Created April 28, 2011 08:52
PHP lint all files added or modified locally
for i in `git status -s | sed -e 's/^.* //'`; do php -l $i; done
@tony4d
tony4d / svn2github
Created April 8, 2011 05:14
Migrate an svn repository to git and github
# Assume your svn repo is located at svn://example.com/myapp/trunk
# Assume your git repo will be located at git@github.com:example/myapp.git
# First you need to generate a list of all committers in your svn tree.
# Credit David Wheeler
# http://www.justatheory.com/computers/tricks/list-all-svn-committers.html
$ svn log --quiet svn://example.com/myapp/trunk | grep '^r' | awk '{print $3}' | sort -u
# Next, create a file in your home directory named svn-committers following this format
mojombo = Tom Preston-Werner <tom@github.com>
@tony4d
tony4d / mongo_inplace_field_update.js
Created March 5, 2011 01:30
Simple way to change data in mongo using existing data in a document
// Here my collection is named articles
// I'm changing the blog_name field in every document in that collection to lowercase
db.articles.find().forEach(function(doc){if(typeof(doc.blog_name) == 'string') {doc.blog_name = doc.blog_name.toLowerCase(); db.articles.save(doc); }})