1
2
3
 def invite_friends
...

Ruby Contoller refactoring

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

In following Home controlle...

51224bdd17878b3b19e8987e9bb336a2 Talk
1
2
3
#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...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
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 Talk
1
2
3
4
    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...

Df2e97f18b5802e199d4920552a52d34 Talk
1
2
3
4
/**
 * 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...

5071c5b861341c0dcfcf6ac86327701f Talk
1
2
3
4
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 ...

5071c5b861341c0dcfcf6ac86327701f Talk
1
2
3
+----------+-------------+------+-----+---------+----------------+
| 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...

6dc0e9a07bcff97ac9b111f36e12f1f6 Talk
1
2
3
4
def tab(name, options = {})
  if name == controller.controller_name.humanize || root_of_path.humanize == name
    content_tag :li, link_to("<span>#{name}</span>", 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 Talk
1
2
3
4
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 Talk
1
2
3
4
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...

72f4ba51b784673a15a1e89d8d9f49d1 Talk
1
2
3
4
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 Talk
1
2
3
4
  %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 Talk
1
v = a[:k][0]  ||  1

Ruby Assignment from array

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

The problem with this code ...

Avatar Talk
1
2
3
4
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.

Avatar Talk
1
2
3
4
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 Talk
1
2
3
4
<?php

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...

6dc0e9a07bcff97ac9b111f36e12f1f6 Talk
1
2
3
4
#!/usr/bin/perl
use strict;
use warnings;
...

Perl MAC Formatting

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

Converting the return from ...

B5603dc8f1e87c251bf9b1d28f31d38f Talk
1
2
3
4
	# 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 Talk
1
2
3
4
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...

Avatar Talk
1
2
3
4
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...

Fadf50b647fa1fb23c793ad5bd4fb6a3 Talk
1
2
3
4
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 Talk
1
2
3
4
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...

880cbab435f00197613c9cc2065b4f5a Talk
1
2
3
-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 ...

671af8c4a2d223c7d2e2ede3a0154975 Talk
1
2
3
class Findplugin
...

Ruby Showing list of plugins in ...

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

Hello,
- I am working on a...

51224bdd17878b3b19e8987e9bb336a2 Talk
1
2
3
4
# A set of monkey patches for the ruby programmer who isn't yet satisified with the core library
class 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 ...

Be072eb0e9f6f81c20541150cabce3ab Talk