Skip to content

Instantly share code, notes, and snippets.

Avatar

Tony Ford tony4d

View GitHub Profile
@tony4d
tony4d / php-lint-git.sh
Created Apr 28, 2011
PHP lint all files added or modified locally
View php-lint-git.sh
for i in `git status -s | sed -e 's/^.* //'`; do php -l $i; done
@tony4d
tony4d / svn2github
Created Apr 8, 2011
Migrate an svn repository to git and github
View svn2github
# 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 Mar 5, 2011
Simple way to change data in mongo using existing data in a document
View mongo_inplace_field_update.js
// 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); }})
You can’t perform that action at this time.