Skip to content

Instantly share code, notes, and snippets.

View jasonrudolph's full-sized avatar

Jason Rudolph jasonrudolph

View GitHub Profile
@jasonrudolph
jasonrudolph / mongo-console
Created June 9, 2012 13:07
Passing Query and Sort Params to MongoHQ RESTful API
# Assuming you're familiar with specifying query and sort options
# via the MongoDB console as shown here, you can specify these same
# options via the MongoHQ RESTful API using the approach shown in the
# file below.
$ mongo staff.mongohq.com:10095/one-rep-max -u REDACTED -p
MongoDB shell version: 2.0.4
Enter password:
connecting to: staff.mongohq.com:10095/one-rep-max
> use one-rep-max;
@jasonrudolph
jasonrudolph / README.md
Created May 17, 2012 00:07
GitHub README Template
@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@jasonrudolph
jasonrudolph / gist:1732424
Created February 3, 2012 20:48
Delete trailing whitespace from all files in current directory tree
find . -type f -print0 | xargs -0 sed -i '' -E "s/[[:space:]]*$//"
@jasonrudolph
jasonrudolph / solid-oo-design-by-sandi-metz-at-goruco-2009.md
Created October 23, 2011 13:56
"SOLID Object-Oriented Design" - Sandi Metz @ GoRuCo 2009

"SOLID Object-Oriented Design" by Sandi Metz @ GoRuCo 2009

Date: May 30, 2009

Video on confreaks.net

Notes

  • Design is all about dependencies
  • If you refer to something, you depend on it.
@jasonrudolph
jasonrudolph / 2011-09-29-why-you-dont-get-mock-objects.md
Created September 29, 2011 18:19
RubyConf 2011: Why You Don't Get Mock Objects

"Why You Don't Get Mock Objects" by Gregory Moeck

RubyConf 2011 | 2011-09-29 | Gregory Moeck (@gregmoeck) | Slides

  • Recommended as the best book on mocks: Growing Object-Oriented Software, Guided by Tests by Steve Freeman & Nat Pryce
  • Common arguments against mocks
    • They duplicate implementation
    • They lead to brittle tests
  • Mock objects + procedural programming = bad idea
  • If you're doing traditional Rails development (which tends to follow more of a "procedural", do-this-and-then-do-that style), mock objects probably aren't for you
@jasonrudolph
jasonrudolph / programming-achievements-suggested-by-github-members.md
Created August 19, 2011 21:25
Programming Achievements: Suggestions from the GitHub Community

Programming Achievements: Suggestions from the GitHub Community

Last week, I published some ideas for leveling up as a developer. I put it on GitHub as a gist, and I encouraged people to modify the list to their liking:

Feel free to fork it and add more achievements. (Make sure they're measurable.)

Or, fork it and mark off the achievements you've already conquered. You might even flag the one that you're currently working on.

So far, more than 270 developers have forked this gist. Many devs have customized their forks as personal to-do lists (e.g., crossing off past achievements and highlighting the goal they're currently pursuing). A number of people have also added new achievements to their forks, indicating additional experiences that they

@jasonrudolph
jasonrudolph / about.md
Last active January 6, 2024 07:40
Programming Achievements: How to Level Up as a Developer
@jasonrudolph
jasonrudolph / how-to-reproduce.sh
Created May 5, 2011 00:16
Rake tasks fail to log when running in production mode
# generate a fresh app
rails -v
rails new whizbang
cd whizbang
# show empty log file
cat log/production.log
# script/runner successfully writes to the log file
./script/rails runner 'Rails.logger.error("Hello from script/runner")' -e production
# git
alias gl='git pull'
alias gp='git push'
alias gd='git diff | mate'
alias gdh='git diff HEAD | mate'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gcap='git commit -v -a && git push'
alias gb='git branch'
alias gba='git branch -a'