1 2 3 4
public static class MidnightPartitioner { public struct SchedulePartition ...
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...
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...
VS08 grants only a maintain...
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...
1 2 3 4
char * str_replace(char *str, char *old, char *new) { int i, count = 0; ...
C str_replace
Pretty weak first pass at a...
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...
1 2 3 4
require 'hpricot' class Parser ...
Ruby Create a Hash from XML usin...
With ruby you could use REX...
1 2 3 4
class Message def initialize right_now = Time.now ...
Ruby Ruby: Date and Time methods
I have a small Ruby on Rail...
1 2 3 4
class Array # insert i between each element in the array ...
Ruby Ruby: array intersperse, ef...
Intersperse is a method of ...
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
I know there's a better way...
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....
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
Originally published at htt...
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...
Essentially there is a text...
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...
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...
I have 6 items in a row. Th...
1 2 3 4
char str[] = "foo bar"; char delims[] = " "; char *word = strtok(str, delims); ...
C strtok WTF
I thought str[] and *str we...
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
Hello. This is from my blog...
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...
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...
1 2 3 4
#!/bin/bash # Global variables ...
Bash Adding speed to script
I'm trying to collect custo...
1 2 3 4
def slug_to_lower(fn): """ Decorator to lowercase string arguments to a function. ...
Python String args to lower decorator
This was used to convert Mi...
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 ...
I have this little class ca...