Don't miss a post! Subscribe to my mailing list.
Pivot Tables in SQL
Sometimes when trying to pivot a large dataset it makes more sense to perform the pivot in SQL rather than using something like Ruport. I always forget how to do this so here's a reminder.
Spellbook: Rails 3 Application Generator
Spellbook is a Rails 3 application generator that aims to make the tedious parts of setting up a new Rails app trivial. You define various settings in YAML and Spellbook runs through each of them prompting you for your choice. After all your choices...
Rails 3 Generators: Lookup Paths
Apparently the new Rails 3 generators do not support looking up custom
generators in ~/.rails/generators
anymore. Here is a bash function
that copies a generator from ~/.rails/generators/GENERATOR
into
your rails app so that it can be used without...
JavaScript Patterns: Module
When I started getting more into JavaScript I was looking for the best ways to organize my code. One of the most popular is to use the Module Pattern. This pattern provides structure and helps you to write self-contained decoupled pieces of code. Here...
Ideas for Splitting Large User Stories
During iteration planning, sometimes user stories need to be split so that they can be better handled. Here are a few ideas for doing just that.
- Split according to data boundaries:
- Try splitting based on the data needed to support the story, like...
JavaScript Patterns: Callback
In JavaScript, functions are objects that can be passed as arguments to other functions. A useful pattern that lets you take advantage of this is the Callback Pattern.
For example, let's say you were implementing a graphing library that would allow...
Ruby's Matrix
The Game of Life
I attended a Code Retreat a few weeks ago where the exercise was to implement Conway's Game of Life. The Code Retreat was awesome and I definitely recommend you check one out. I wasn't familiar with the Game of Life before attending...
Faking Data with Ranges in Ruby
On a recent project I needed to create some fake data for some reporting screens. I was using StaticMatic to generate a mockup site and decided to try out the Faker gem for creating the data. Faker worked out well, but it doesn't have any support for...
Refactoring Case Statements in Ruby
case
(or switch
) statements in your code have a tendency
to grow over time. After awhile they can become unmanageable and hard to read.
As a general rule of thumb I try to refactor case
statements if they
are more than one screen long. But how can...
Rails Domain Generation with SQL Editor
Update: I have a new Rails 3 compatible version called model_maker available on GitHub.
A Problem
I'm a visual person by nature, so when I start a new project I like to spend some time drawing out screens and domain models. From these I then write...