This is where I keep little snippets of useful code, miscellaneous thoughts, links and solutions to problems I’ve come across. I warn you that most, if not all of these entries are incredibly boring...
Perl
August 14, 2008
Here's a little command-line to find email addresses in a body of text, lower case them, remove duplicates, remove addresseses that you don't care about, then build an SQL statement to feed to a database. (I used this to remove some bounced email messages from a recent mailing)
perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}' bounced.txt | tr "[:upper:]" "[:lower:]" | sort -u | grep -v "postmaster" | grep -v "cogbox" | grep -v "mailer-daemon" | grep -v "qqest" | grep -v "managerplus" | sed 's/^/DELETE FROM foomanchoo WHERE email LIKE \"%/' | sed 's/$/%" LIMIT 1;/' > to_remove.txt
Good Quote
July 02, 2008
Content precedes design. Design in the absence of content is not design, it’s decoration. - Jeffery Zeldman
SEO Voo Doo
May 14, 2008
With all the black-magic voo doo that's out there regarding SEO, it's hard to know what is worth doing and what isn't. Until the search engines open up their algorithms, we all have to basically guess at what will make a difference. These guys (who are expert SEO-types) got their noggs together and weighted a list of SEO things to worry about. Nicely done fellas. Now our guesswork can be replaced with careful testing. <http://www.seomoz.org/article/search-ranking-factors>
Vernon Howard
April 28, 2008
"You must dare to disassociate yourself from those who would delay your journey... Leave, depart, if not physically, then mentally. Go your own way, quietly, undramatically, and venture toward trueness at last."
Design
April 07, 2008
Just a quote I always think about when I think about design. "Most people make the mistake of thinking design is what it looks like. People think it’s this veneer — that the designers are handed this box and told, ‘Make it look good!’ That’s not what we think design is. It’s not just what it looks like and feels like. Design is how it works." - Steve Jobs
Lorem Ipsum Schmipsum
March 18, 2008
Tired of reading the same old lorem ipsum schmipsum when laying out blocks of text? Then get some great looking text from this excellent web app: <http://justanotherfoundry.com/tools/generator/>
svn export
March 12, 2008
So one of the annoying things about subversion is that it keeps an .svn directory inside each directory for things it's keeping track of, so you have all these smartypants little .svn folders hanging out in your projects code.
If you want to clean up .svn directories for some reason, then you can use the svn export command. Invoking that command will export a clean .svn-less copy of the project for zipping up or whatever.
Spell checking in Firefox
March 06, 2008
So enabling spell checking in all form fields (not just text areas) do this: Open Firefox, type about:config for the address. Type "layout.spellcheckDefault" in the filter area, change the 1 to a 2 and restart Firefox. Test. Nice.
migrations in rails
February 19, 2008
A nice cheat-sheet for using migrations in rails: <http://dizzy.co.uk/ruby_on_rails/categories/migrations/contents/rails-migrations>
getting activescaffold to work
January 30, 2008
Activescaffold 1.1.1 note:
I also had to install manually to avoid the same error as others have seen. Also, I had to change (in the routes.rb file, for the notes controller:
map.resources :notes
to
map.resources :notes, :active_scaffold => true
in order to get the seach feature to work properly.