1 2 3
#!/bin/bash echo -e "\n I wish you a merry Christmas and an happy new year! \n" exit(0);
Bash Multi language refactor
by Eineki,
December 25, 2008 08:59,
6 refactorings
1 2 3 4
# This is what an application build with our framework would look like. # Run with: # rackup app.ru ...
Ruby Very Simple Rack framework
I'll be presenting http://r...
1 2 3 4
class AccountsController < ApplicationController layout 'application' ...
Ruby Password update code
Mostly straight from a tuto...
1 2 3 4
using System; using System.Collections.Generic; using System.Linq; ...
C# Pointers in C#
I am trying to work out how...
1 2 3 4
class JobBoard < ActiveRecord::Base has_many :job_board_postings ...
Ruby Ruby has_finder on has_many ?
This smells... one of the m...
1 2 3 4
class Fixnum def <=>(b) self % b ...
Ruby Challenge: Ugliest Ruby Fiz...
by jamesgolick,
December 20, 2007 21:54,
8 refactorings
So, after seeing some ugly ...
1
<%= (@post.category ? @post.category.name : '') + ' ' + link_to(@post.title, post_path(@post)) %>
Ruby Handling nil object
@post.category can be nil, ...
1 2 3
class PostsController < ResourceController::Base ...
Ruby resource_controller: Redesi...
Backstory on my blog: http:...
1 2 3 4
namespace :migrations do desc 'reverts, renames and re-executes uncommitted migrations that conflict with already committed migrations' ...
Ruby Rails migration conflict re...
Explained here: http://www....
1 2 3 4
require 'erb' class ClientMigrator def self.create(fields) ...
Ruby Dynamic migrations for rails
by danielharan,
October 12, 2007 04:27,
1 refactoring
How do you create a rails p...
1 2 3 4
tab() # new tab from current dir { osascript -e " ...
Bash Open a new tab in current d...
by macournoyer,
October 04, 2007 18:07,
2 refactorings
Here's a small script I wro...
1 2 3 4
var Rating = Class.create(); Rating.prototype = { initialize: function(element, rating, options) { ...
JavaScript Rating system for this site
by macournoyer,
September 29, 2007 14:09,
3 refactorings
Here's the code of the rati...
1 2 3
before_filter :login_required
...
Ruby restful_authentication role...
by jamesgolick,
September 27, 2007 10:40,
7 refactorings
This is a couple of lines t...
1 2 3 4
task :extract_style do css = File.read 'public/stylesheets/code.css' css.gsub! "{\n", '{' ...
Ruby Extracting style from a CSS...
by macournoyer,
September 25, 2007 21:18,
2 refactorings
Here's a Rake task I use to...
1 2 3
def code puts 'cool' ...
JavaScript On Is this year a leap year?
by macournoyer,
September 23, 2007 13:13
Nice tip Gary! I didn't kno...
1 2 3 4
class CodeFormatter cattr_reader :syntaxes @@syntaxes = Uv.syntaxes.sort ...
Ruby [FEATURE] Sections in code!
by macournoyer,
September 22, 2007 08:44,
No refactoring
Introducing a new feature: ...
1 2 3 4
units = %w{ one two three four five six seven eight nine } File.open('counter.txt', 'w') do |f| ...
JavaScript On Is this year a leap year?
by macournoyer,
September 21, 2007 08:20
I'll try to add sections wi...
1 2 3 4
def link_to_remote_with_spinner(title, options) element_id = options.delete(:id) || ('link_to_' + title.underscore.tr(' ', '_')) container_id = options.delete(:container_id) || element_id ...
Ruby On link_to_remote_with_spinner
by macournoyer,
September 21, 2007 07:42
With the above code you cou...
1
Dir["test/**/*_test.rb"].size.to_f / Dir["app/**/*.rb"].size.to_f
Ruby On Test file to code file ratio
by macournoyer,
September 21, 2007 07:34
Nice! Or even shorter, with...
1 2 3 4
Object.extend(Date.prototype, { isLeap: function(){ var year = this.getFullYear(); ...
JavaScript On Is this year a leap year?
by macournoyer,
September 21, 2007 07:30
I'm pretty sure the last ye...
1
Dir.glob("test/**/*_test.rb").size.to_f / Dir.glob("app/**/*.rb").size.to_f
Ruby On Test file to code file ratio
by danielharan,
September 21, 2007 07:22
Well, here is a more ruby w...
1 2 3 4
# Behave like +link_to_remote+, but shows a spinner while the request is processing. # link_to_remote_with_spinner 'Hi', :url => hi_path # You can specify the spinner and the container to hide ...
Ruby link_to_remote_with_spinner
by danielharan,
September 20, 2007 14:17,
4 refactorings
We use this utility interna...

Can you rewrite this onelin...