Writing
Notes on building software — the decisions that age well, the ones that don't, and what I learn in between.
-
Uploading Files with Curl
Courtesy of http://ariejan.net/2010/06/07/uploading-files-with-curl/
-
Using to_sentence method on an Array in Ruby on Rails
Declare separator and the connector
-
Collection Select Helper and OnChange Event in Rails
Given a collection of Active Record objects, you may use the collection\select helper method to produce a select form field. You need to pass in a number of arguments to the helper function. 1)...
-
Repost
This post is inspired by http://pupeno.com/blog/really-resetting-the-database/comment-1179. But as my blog mostly serves as a reference for my future self, I'd like to reprint this little snippet...
-
Rounded Corners with CSS
-
Select Distinct in Rails with Active Record
-
A List of Every High School in the United States in Pipe Delimitted Form (2005)
Here is a text file containing every high school in the United States(2005), including city, state, zip code and high school name. us\high\schools\pd
-
The Context of Markup vs Expressions of Equality in Determining the Meaning of Angled Brackets
In the Wordpress editor (html mode) you'll need to become friends with < and if you plan on showing any code (php, html... xml, most languages actually) that readers will want to understand. I...
-
Simple Activity Stream Implementation in Rails
There are many ways to tackle the Facebook style activity stream feature for your app. The simplest approach, which you can tack on at almost any moment, is what I'll describe here. You don't have...
-
Scope Routes/URLs By Username (like Twitter) in Your Rails Application
There are a few things that need to be taken care of before you can get this to work. The first thing (although, any of the following steps can be done in any order) to take care of involves your...
-
Using Formtastic to Cleanly Create Nice Looking Forms in Rails
Forms can easily get cluttered when you're dealing with a lot of form fields... er, ERB tags. I've written about extending Rails form builders, which certainly goes along way to shrinking your...
-
TODO and Custom Annotations in Rails Applications
While writing software it's common to leave comments for your future self. For instance, if you have written some code but realize that it should be refactored to be more efficient, you may place...
-
Load All ActiveRecord::Base Model Classes in Rails Application
Here is a simple rake task which will instantiate all of your Active Record models, provided that they are located in the RAILS\ROOT/app/models directory. Interestingly, all plugin models are...
-
How Beautiful is Ruby?
Working with Ruby and in particular Rails, it's easy to take the beauty inherent in the language for granted. I mean look at this code. If you read it aloud to yourself, it reads like an english...
-
Deploying to Dreamhost
Remember to include the host declaration in the database.yml file when you deploy to Dreamhost. Dreamhost does not use "localhost" which is typically the default setting when using the mysql...