Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason Rudolph jasonrudolph

View GitHub Profile
@jasonrudolph
jasonrudolph / mongo-console
Created Jun 9, 2012
Passing Query and Sort Params to MongoHQ RESTful API
View mongo-console
# 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
GitHub README Template
View README.md
@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created Feb 12, 2012
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
View git-branches-by-commit-date.sh
# 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 Feb 3, 2012
Delete trailing whitespace from all files in current directory tree
View gist:1732424
find . -type f -print0 | xargs -0 sed -i '' -E "s/[[:space:]]*$//"
@jasonrudolph
jasonrudolph / solid-oo-design-by-sandi-metz-at-goruco-2009.md
Created Oct 23, 2011
"SOLID Object-Oriented Design" - Sandi Metz @ GoRuCo 2009
View solid-oo-design-by-sandi-metz-at-goruco-2009.md

"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 Sep 29, 2011
RubyConf 2011: Why You Don't Get Mock Objects
View 2011-09-29-why-you-dont-get-mock-objects.md

"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 Aug 19, 2011
Programming Achievements: Suggestions from the GitHub Community
View programming-achievements-suggested-by-github-members.md

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 Jun 27, 2022
Programming Achievements: How to Level Up as a Developer
View about.md
@jasonrudolph
jasonrudolph / how-to-reproduce.sh
Created May 5, 2011
Rake tasks fail to log when running in production mode
View how-to-reproduce.sh
# 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
View git-aliases
# 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'