1 2 3 4
import java.util.Scanner; public class AsciiSquare { ...
Java On ascii square
by Jeremy Weiskotten,
May 21, 2008 19:10
Ruby On before_filter in model???
by Jeremy Weiskotten,
April 21, 2008 14:55
There's a similar set of re...
1 2 3 4
class Race < ActiveRecord::Base before_validation :set_abbreviation ...
Ruby On Help generating abbreviatio...
by Jeremy Weiskotten,
April 08, 2008 00:24
The problem is with chop.na...
1 2 3 4
@week_endings ||= Actual.get_week_endings(4.weeks.ago.to_date) last = @week_endings.last.week_ending 6.times do |i| ...
Ruby On Appending future dates to t...
by Jeremy Weiskotten,
April 03, 2008 19:55
I think you can simplify it...
1 2 3 4
def calculate_price_of_credits(credits, rates=nil) rates ||= [ [50000, 0.005], [25000, 0.006], [10000, 0.007], [5000, 0.008], [0, 0.01] ] ...
Ruby On Ugly method for calculating...
by Jeremy Weiskotten,
March 08, 2008 01:30
A slightly more condensed v...
1 2 3 4
def calculate_price_of_credits(credits) rates = [ 0.005, 0.006, 0.007, 0.008, 0.01 ] tiers = [ 50000, 25000, 10000, 5000, 0 ] ...
Ruby On Ugly method for calculating...
by Jeremy Weiskotten,
March 07, 2008 21:21
Here's a refactoring with a...
Ruby On Simple model methods to ret...
by Jeremy Weiskotten,
March 06, 2008 18:43
rpheath, no it won't return...
Ruby On Simple model methods to ret...
by Jeremy Weiskotten,
March 05, 2008 21:05
rpheath, that's not going t...
1 2 3 4
def self.get_budgeted_hours(charge, rollup) @value = find_by_charge_id_and_rollup_id(charge, rollup) (@value && @value.budgeted_hours) || '0' ...
Ruby On Simple model methods to ret...
by Jeremy Weiskotten,
March 05, 2008 01:10
The dynamic find_by is good...
1
month.months.ago
Ruby On last_number_of_months
by Jeremy Weiskotten,
January 22, 2008 11:51
Rails provides an alternati...
1
NameAddress[] entries = (NameAddress[]) list.toArray(new NameAddress[list.size()]);
Java On clean up nested loops?
by Jeremy Weiskotten,
January 17, 2008 19:42
One thing you can do easily...
1 2 3 4
class User has_many :messages do def by_type(type, options={}) ...
Ruby On Rails has_many count
by Jeremy Weiskotten,
January 12, 2008 21:18
To improve on Ryan's refact...
1 2 3 4
<p>Messages:</p> <p> ...
Ruby On Rails has_many count
by Jeremy Weiskotten,
January 11, 2008 00:19
You should let ActiveRecord...
1 2 3 4
<script type="text/javascript"> window.onload = function() { var anchors = document.getElementsByTagName('a'); ...
JavaScript On Shorten links
by Jeremy Weiskotten,
January 08, 2008 14:31
This isn't a refactoring pe...
PHP On Replace user input with link
by Jeremy Weiskotten,
January 02, 2008 23:21
Some examples of PHP linkif...
1 2 3 4
public class Car { public static class Builder { ...
Java Fluent Builder
by Jeremy Weiskotten,
December 24, 2007 02:56,
1 refactoring, tagged with java, fluent interface, builder
Here's an example of the Bu...
1 2 3 4
def list_for_blogentries(user) hash = user.blogentries.group_by {|entry| entry.created_at.to_s(:db).first(10)} hash.each_pair {|date, entries| puts date; entries.each {|entry| puts link_for_entry entry}} ...
Ruby On Refactor my blog item helper
by Jeremy Weiskotten,
December 19, 2007 14:48
I'm not sure what your link...
1 2 3 4
# Action to toggle a favorite def favorite message = Message.find params[:id] ...
Ruby On Refactor my favorite action.
by Jeremy Weiskotten,
December 12, 2007 18:39
I'd move the favorites mana...
Ruby On Why does this look weird in...
by Jeremy Weiskotten,
December 07, 2007 14:58
Have you tried validating t...


Here's a different approach...