Skip to content

Instantly share code, notes, and snippets.

@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); }})
@tony4d
tony4d / ruby-from-source.sh
Last active August 29, 2015 14:02
Compile ruby from source for rbenv on OS X
# Assumptions:
# - You are using rbenv, installed in ~/.rbenv
# - You are using homebrew
# - You want to install ruby 2.1.2 (for example)
#
# Make sure you have openssl installed first
brew install openssl
# Before you begin, download ruby source from https://www.ruby-lang.org/en/downloads/
@tony4d
tony4d / keybase.md
Created April 17, 2014 09:24
Keybase verification

Keybase proof

I hereby claim:

  • I am tony4d on github.
  • I am tony4d (https://keybase.io/tony4d) on keybase.
  • I have a public key whose fingerprint is 3F64 5B71 C70B 4BFE 5E2A D205 2AEC 93AD 5C92 5CAC

To claim this, I am signing this object: