1
2
3
4
<script language="javascript">
function toggleLinkAndElement (link, elementID, text) {

...

JavaScript Better way in Prototype.js?

by Jermaine, July 02, 2009 20:59, No refactoring

Hi Everyone,

I've got t...

79b4825afe5c22c7d6226037ac81ee69 Talk
1
2
3
4
public static class MidnightPartitioner
    {
        public struct SchedulePartition
...

C# Split DateTime Range Around...

by MRuston, July 01, 2009 14:42, No refactoring, tagged with DateTime, midnight, split

I have this little class ca...

Bac730989e88a593d5f23cfa4d41dc6f Talk
1
2
3
4
require 'hpricot'

class Parser
...

Ruby Create a Hash from XML usin...

by smacks, June 25, 2009 12:23, No refactoring, tagged with ruby, hpricot, xml, soap, hash

With ruby you could use REX...

34d2ae3f7fdcec853ec24cf85715da96 Talk
1
2
3
4
@team.statements.scoped({ 
               :select => "statements.*, users.first_name",
               :joins => "INNER JOIN users ON users.id = statements.user_id",
...

Ruby Named Scopes in Relations

by sebastian.deutsch.myopenid.com, June 24, 2009 15:38, 1 refactoring, tagged with rails named_scope relation

I have two models: Teams an...

Bfca16459c82a7836c3d5c8d79f0b640 Talk
1
2
3
4
char *
str_replace(char *str, char *old, char *new) {
  int i, count = 0;
...

C str_replace

by Tj Holowaychuk, June 23, 2009 21:23, 1 refactoring, tagged with c string replace

Pretty weak first pass at a...

F1e3ab214a976a39cfd713bc93deb10f Talk
1
2
3
4
def upgrade_and_restart
  @myvocabulary.upgrade
  nextmyvocabulary = Myvocabulary.draw(current_user.id, params[:position], @myvocabulary.vocabulary.lesson.proficiency.id)
...

Ruby shorten long variable names...

by dive.myopenid.com, June 22, 2009 18:52, 5 refactorings, tagged with rails, models, variable names

I wonder how you make a lin...

6cb63e2304cb64236520d0e3e353c9bc Talk
1
2
3
4
/// <summary>
/// Compares the content of two enumerables for equality. Order
/// of elements does NOT matter. Elements may exist multiple
...

C# IEnumerable<> compari...

by mafutrct, June 22, 2009 07:08, 5 refactorings, tagged with IEnumerable, Comparison, Dictionary

VS08 grants only a maintain...

A7c22254d91baa9ca18786a9d46549f0 Talk
1
2
3
4
class Message
  def initialize
    right_now = Time.now
...

Ruby Ruby: Date and Time methods

by ravinggenius, June 20, 2009 07:53, 7 refactorings, tagged with ruby, non-rails, sinatra

I have a small Ruby on Rail...

6c13f781b81579be36f2ec1193224db4 Talk
1
2
3
4
def prem(s,nx = [])
  return nx.join if s.empty?
  s.collect { |b| prem(s-[b],nx+[b]) }.flatten
...

Ruby Erlang Riddle for Rubists

by dorkalev, June 13, 2009 06:59, 3 refactorings, tagged with erlang, ruby, permutations

Originally published at htt...

0a5eb48929f4014d1a1bf448517158d5 Talk
1
2
3
4
# stats is an array

@popular_urls = stats.group_by{|s| s.request_uri}.sort_by {|s| s.second.size}.reverse
...

Ruby Extract method

by webandy.myopenid.com, June 12, 2009 15:28, 2 refactorings, tagged with ruby, rails

Hello. This is from my blog...

Avatar Talk
1
2
3
4
<script type="text/javascript">

  
...

Ruby cache the javascript object

by abhijeetgore.myopenid.com, June 12, 2009 12:35, No refactoring

Hi This question is specifi...

51224bdd17878b3b19e8987e9bb336a2 Talk
1
2
3
4
    char str[] = "foo bar";
    char delims[] = " ";
    char *word = strtok(str, delims);
...

C strtok WTF

by Tj Holowaychuk, June 11, 2009 21:02, 2 refactorings, tagged with strtok

I thought str[] and *str we...

F1e3ab214a976a39cfd713bc93deb10f Talk
1
2
3
4
  - @media.in_groups_of(6, false) do |group|
    .row
      = render :partial => 'media/media', :object => group[0] unless group[0].blank?
...

Ruby Iterating An Array - Need t...

by DFischer, June 11, 2009 06:51, 2 refactorings, tagged with ruby rails haml

I have 6 items in a row. Th...

73af4fece11ee3767dc13e89cdc08500 Talk
1
2
3
4
module ActiveSupport
  Inflector.inflections do |inflect|
    inflect.plural(/$/, 's')
...

Ruby Redundant Method Calls

by reprogrammer.myopenid.com, June 10, 2009 23:23, 2 refactorings

What is the best way to sim...

Dde3b34749219173bbf3e07ca710eccc Talk
1
2
3
4
def schema
  raw_schema_json = ActiveSupport::JSON.decode(self.schema_json)
  schema = []
...

Ruby Decoding a json object whil...

by sebastian.deutsch.myopenid.com, June 10, 2009 18:01, 3 refactorings, tagged with ruby, rails, json

I'm decoding a json object....

Bfca16459c82a7836c3d5c8d79f0b640 Talk
1
2
3
4
class Array

   # insert i between each element in the array
...

Ruby Ruby: array intersperse, ef...

by spoonerism.myopenid.com, June 10, 2009 11:00, 4 refactorings, tagged with speed, big O, ruby

Intersperse is a method of ...

A5dbf79f90041e79418a6829d414b46e Talk
1
2
3
4
<?php

// open the db connection
...

PHP DRY switch

by htxt, June 10, 2009 10:16, No refactoring, tagged with php, wordpress, switch, dry

This is part of an events p...

13e1f55ad0de3139470536022839ed89 Talk
1
2
3
4
def current_snapshot
   d = nil
...

Ruby avoid for loops

by inriz.myopenid.com, June 09, 2009 13:16, 2 refactorings, tagged with ruby for loop

hey folks,

how it will l...

Avatar Talk
1
2
3
4
<select id="<%Response.Write(QuantityId); %>" onmousewheel="return(false);" name="<%Response.Write(QuantityId); %>"
	onchange="javascript:<%Response.Write(ChangeHandler); %>">
	<%
...

C# Asp.Net Dropdown list

by emptyiness12z.blogspot.com, June 08, 2009 19:06, 3 refactorings, tagged with asp.net

I know there's a better way...

Avatar Talk
1
2
3
4
//e is the object, and 'op' is a parameter passed that tells us
//if we're increasing or decreasing the value.
function step_change(e, op) {
...

JavaScript An incrementor function tha...

by Danny Peck, June 08, 2009 15:58, 2 refactorings, tagged with math, increment, javascript

Essentially there is a text...

8f5553306c2cf7f4b14153f6117f8e9b Talk
1
2
3
4
<html>

<body>
...

PHP Drop down menu linked to ta...

by musicaly49.myopenid.com, June 08, 2009 10:38, No refactoring

Hi, i've been searching the...

49636649e83db1c047c9fc9644d99940 Talk
1
2
3
4
Image background;

try {
...

Java Background Image

by okram87.myopenid.com, June 07, 2009 09:31, No refactoring, tagged with background, jframe

Do you know how I can apply...

3f9f2d31e0d42bc91d3135953eb41d2e Talk
1
2
3
4
class User < ActiveRecord::Base
  has_many :assets, :foreign_key => 'creator_id'

...

Ruby Change a finder method w/ p...

by saizai.livejournal.com, June 06, 2009 00:16, No refactoring, tagged with rails, activerecord, associations, named_scope

How do I turn this into a h...

237338834f2f8948e862e91392a8c1b4 Talk
1
2
3
4
def slug_to_lower(fn):
    """
    Decorator to lowercase string arguments to a function.
...

Python String args to lower decorator

by justinlilly.myopenid.com, June 04, 2009 18:04, 5 refactorings, tagged with python, decorator

This was used to convert Mi...

Avatar Talk
1
2
3
      send "Unrecognized command:  #{data}"
      puts "Unrecognized command:  #{data}"

Ruby Two lines: Same argument, ...

by claimid.com/findchris, June 03, 2009 19:20, 4 refactorings

Is there a way to DRY this ...

Avatar Talk