Recent codes - RefactorMyCode.com

Refactor :my => 'code'

More Jobs

Recent

Popular

123
 def invite_friends...

Ruby Contoller refactoring

by DG, July 30, 2008 09:35, 2 refactorings

In following Home controlle...

123
#include <math.h>#include <stdio.h>...

C Fastest way to get value of pi

by Chris Jester-Young, July 30, 2008 03:50, No refactoring, tagged with pi, speed, language agnostic

Solutions welcome in any la...

123
def granny_says(str)        ...

Ruby Exercise: Deaf Grandma

by houston b-g, July 29, 2008 18:28, 4 refactorings

I've been working on this p...

33b53c3fda38b2464e11ebcddefa6235
1234
    if @foo.update_attributes(params[:foo]) and @foo.bar.update_attributes(params[:bar])      redirect_to foo_url(@parent)    else...

Ruby Saving multiple models in o...

by rafeco, July 29, 2008 15:56, 1 refactoring, tagged with rails, activerecord, controller

What's the best way to save...

1234
/** * http://www.openjs.com/scripts/events/keyboard_shortcuts/ * Version : 2.01.B...

JavaScript Handling Keyboard Shortcuts...

by Tien Dung, July 29, 2008 09:30, 2 refactorings

I found below code very use...

1234
module ThinkingSphinx  class Search    class << self...

Ruby How to extend a class prope...

by Tien Dung, July 29, 2008 04:09, No refactoring, tagged with ruby metaprogramming

Recently, I need to extend ...

123
+----------+-------------+------+-----+---------+----------------+| Field    | Type        | Null | Key | Default | Extra          |...

PHP Object with Field names as ...

by Ishkur, July 28, 2008 19:35, 4 refactorings, tagged with php5, field names, database, object

What I am trying to do is a...

1234
def tab(name, options = {})  if name == controller.controller_name.humanize || root_of_path.humanize == name    content_tag :li, link_to("#{name}", options), :class => "active"...

Ruby How to DRY this up

by idlefingers, July 25, 2008 13:30, 4 refactorings, tagged with rails, tabs

This is for a tabbed naviga...

2b404bb55d9b5dc78841795c4b731771
1234
require 'win32ole'autoit = WIN32OLE.new('AutoItX3.Control')...

Ruby Easier way to do this?

by tyranarchy.myopenid.com, July 24, 2008 07:08, No refactoring

This is for the online poke...

74a501ceeba2dae24e7200d12714dccd
1234
this.getHttpRequest(identifier).onreadystatechange = function() {	try {		ajaxChat.handleResponse(identifier);...

JavaScript AJAX makeRequest

by Martindale, July 23, 2008 03:02, 1 refactoring, tagged with ajax

This code crashes Firefox 3...

1234
class User < ActiveRecord::Base    has_many :orders...

Ruby rails ActiveRecord finder_s...

by jared, July 23, 2008 00:36, 1 refactoring, tagged with rails activerecord finder_sql

I think there's a way to do...

473b57acbf0d02127db3d2af78dffaca
1234
  %w(er_quantitative pr_quantitative p53_quantitative fish_quantitative oncotype_quantitative).each do |field|    class_eval <<-RUBY      def #{field}_s...

Ruby Formating a decimal field a...

by jdzak.myopenid.com, July 22, 2008 22:57, No refactoring

er_quantitative, pr_quantit...

Bdc4a6aa272bea6d585fbe8be6d1ba38
1
v = a[:k][0]  ||  1

Ruby Assignment from array

by jason, July 22, 2008 10:15, 7 refactorings

The problem with this code ...

1234
puts "Yes means No and No means Yes. Delete all files [Y]?"yes, no = "no", "yes"...

Ruby BOFH shell login script

by aaaarg.livejournal.com, July 21, 2008 23:23, 1 refactoring

Optimize for poeticness.

1234
module DashboardHelper  def activity_message_for(object)    case object.class.name...

Ruby Dashboard

by Kryckan, July 21, 2008 21:01, 4 refactorings, tagged with rails, helper

This works but it's kind of...

C8c549e9bb39135192db53d238e19f3e
1234
class DB {...

PHP PHP5 Database Clas

by Ishkur, July 21, 2008 16:33, 2 refactorings, tagged with php5, database, class

For the most part, this cla...

1234
#!/usr/bin/perluse strict;use warnings;...

Perl MAC Formatting

by mrxinu, July 20, 2008 23:25, 3 refactorings, tagged with mac snmp

Converting the return from ...

1234
	# This method searches a source by  the http, the www and the trailing / to a url	def self.find_by_url(url)		Source.find :first, :conditions => [ " url = ? OR url = ? OR url = ? OR url = ? ", url, url.gsub("http://", "http://www"), url + "/", url.gsub("http://", "http://www")+"/"] ...

Ruby Find a URL in a database

by julien, July 18, 2008 17:16, 3 refactorings, tagged with find, url

Hi!
I've a got a website A...

B30ce50678f0e934eaa6697425c59dd7
1234
module Enumerable    def cluster         sort.inject([[]]) do |out, n|...

Ruby Enumerable#cluster

by Erik, July 18, 2008 02:44, 10 refactorings, tagged with cluster, inject, array

%w[app noot app mies zoo m...

1234
def link_to_param(text, param, values)    @qs ||= {}    if @qs.blank?...

Ruby Horrible method to parse a ...

by Ivan, July 17, 2008 22:45, 2 refactorings, tagged with rails, links, query string

In a Rails application, I h...

1234
def self.paged_search(query, from, category, locality, page, per_page = 10)    query_str = []    query_prms = []...

Ruby Ferret, pagination and mult...

by jboss, July 17, 2008 07:34, No refactoring, tagged with rails, search, find, join, ferret, paginate

This code has multiple flaw...

3e8242329ec2756662c818a9baba76f9
1234
class AccountsController < ApplicationController  layout 'application'...

Ruby Password update code

by danielharan, July 16, 2008 16:59, 4 refactorings, tagged with rails, restful, authentication

Mostly straight from a tuto...

123
-module(endsrename)....

Erlang Nintendo DS roms renamer

by edbond, July 16, 2008 13:00, No refactoring, tagged with erlang, nintendo, ds, nintendo ds, rename, otp

Nintendo DS roms and saves ...

123
class Findplugin...

Ruby Showing list of plugins in ...

by DG, July 15, 2008 12:41, No refactoring

Hello,
- I am working on a...

1234
# A set of monkey patches for the ruby programmer who isn't yet satisified with the core libraryclass Object  # useful for reflection...

Ruby A Set of Monkey Patches for...

by Ollie , July 15, 2008 04:06, No refactoring, tagged with core library, monkeypatch, monkey patch

I find ruby's core library ...

API, , Blog © A project by Marc-André Cournoyer