Author: anthony

Git – move accidental commits to a different branch

If you’ve been working on a common staging branch when you thought you were working on a personal feature branch, you can move your work by doing the following: git checkout feature_branch git cherry-pick SHA (Do this for each commit on the mistaken branch) git checkout staging git reset –hard HEAD~n (where n = the […]

Git – list commits in topic branch that are not within the master branch

git log topic ^master –no-merges This will list all commits within the topic branch that are not found within the master branch. I needed this to cherry-pick specific commits out of a working feature branch when I mistakenly rebased against a common staging branch.

WordPress permalink 404 not found with .html or .htm in error message

WordPress will throw a 404 not found error, with either a .html or .htm extension for permalink pages if a file of the same name can be found within the web root directory. So, for instance: * If you create a new wordpress page called ‘contact’, and * You create an HTML page called ‘contact.html’ […]

Rails select method with default value

When using the select form builder method in rails, for instance: In conjunction with the options_from_collection_for_select method, like :field, options_from_collection_for_select(@fields, ‘id’, ‘name’) Remember, there is a fourth argument in the above method, which defines the selected value, like so :field, options_from_collection_for_select(@fields, ‘id’, ‘name’, @object.field)

Keep heroku from falling asleep / idling (even with PHP)

Ruby on Rails Scenario The easiest way to keep a Rails App from idling is to use New Relic Standard (free), in conjunction with their availability monitoring. You can do this in a couple of ways: Issue the following command with the Heroku Toolkit heroku addons:add newrelic:stark Or, login to your heroku account and provision […]

Monitor production resque with local resque-web

This post assumes you are processing background jobs on a development/production environment utilizing Redis and Resque. If you’re monitoring your local resque instance with resque-web, just run the following commands to change the resque-web’s redis reference to your production redis instance resque-web -K resque-web -r [your redis location] If you’re using RedisToGo, for instance, you […]