MustModify Blog: Recent Posts

[Valuable] parsing attributes

May 17, 2010
This post is me thinking 'out loud' about how to add custom parsing "ruby gem valuable": In the past I ran into quite a few situations where I wanted to parse / process / format certain attributes as they came in. There seemed to be a lull in that so I hadn't implemented it, but now I find myself wanting it again....

using actual numbers with putty and vim

April 14, 2010
I'd been having troubles wherein I would try to use my numeric keypad in VIM but would get letters. Instead of 123456 I would get qrstuv. The fix for me was a putty setting... Terminal > Features > Disable application keypad mode should be checked. REFERENCE: "Putty numeric keypad...

rspec says: undefined method 'should_receive' for SomeClass

April 13, 2010
This took up an hour of my life today. Here's the fix. At some point I'll go back and research "Double Ruby": to figure out what went wrong, but for now, tests are failing validly... ---diff --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,7 +20,7 @@ Spec::Runner.configure do |config| ...

tail - follow two to n files at once

January 27, 2010
I often use tail -f filename.txt ... then recently I realized I was switching back and forth between test.log and development.log, and that only one was being used at a time -- could I follow both at the same time? Turns out you can, and really easily. --- tail -f file1.txt file2.txt --- or even --- tail -f log/*.log --- useful and...

regenerating httpd.include from capistrano with sudo

November 19, 2009
As a general rule, if you need to do something with sudo in your cap scripts, and you don't know why that might be a bad idea, something has gone wrong. I recently ran in to an exception. For various reasons, we need to auto-generate our httpd.include file after deploying to production. note: command names have been change to protect me from...

Show alert messages in firebug

October 26, 2009
A cool javascript trick: --- alert = console.log --- then --- alert('hello') --- will show up in Firebug instead of an alert screen: --- "hello"

Get a List of Bad Links from Rails Log

October 22, 2009
If you have a Ruby on Rails app and you want to generate a list of the URLs that have generated 404s from your logs, here's one way: --- perl -n -e '/No route matches "(.*)" with .*/&&print "$1\n"' log/production.log | sort | uniq>public/bad_paths.txt --- then view: http://production_site/bad_paths.txt We're using...

sometimes it's the little things

October 20, 2009
I was looking through the ways you can tweak gMail and found this. I can't say how often it would have prevented me from looking like an idiot. "Forgotten Attachment Detector": - Prevents you from accidentally sending messages without the relevant attachments. Prompts...