1
2
3
4
<?php
function parse_accept_headers($default = 'html'){
  $formats = array(
...

PHP Parse HTTP Accept headers

by hubfactor, January 07, 2009 16:25, No refactoring, tagged with http

a) define a list of MIME ty...

Ed9c50a6db8b5e078b5ef84306a8477c Talk
1
2
3
4
namespace MyUtilities {
    using System;
    using System.Diagnostics;
...

C# Int32 Quick Parser

by Hosam Aly, January 07, 2009 11:16, 5 refactorings, tagged with parsing

I wrote a few parsing metho...

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

Perl Find the file with the high...

by bonzobo.blogspot.com, January 07, 2009 07:19, 2 refactorings, tagged with sort mtime date files

Here's a small script that ...

43c4376065a1db662eea18f2437c832a Talk
1
2
3
4
def before_create_save(record)
  vouchercode = generate_vouchercode(8)
  while Voucher.find(:first, :conditions => {:vouchercode => vouchercode})
...

Ruby While loop to get unique value

by dive.myopenid.com, January 06, 2009 16:44, 1 refactoring, tagged with while, uniqueness

Coming from python, I would...

6cb63e2304cb64236520d0e3e353c9bc Talk
1
2
3
4
object.constraints.each do |c|
  p = object.particles[c.index]
  if c.component == :x
...

Ruby ruby metaprogramming

by micktaiwan, January 06, 2009 00:30, 4 refactorings, tagged with ruby, metaprogramming

So here here my ugly code. ...

2f6686bd2c6bb633a1cbf7b5a73c8491 Talk
1
2
3
4
require 'ostruct'
require 'rubygems'
require 'extlib/blank'
...

Ruby includes_all?

by Tj Holowaychuk, January 05, 2009 21:14, 3 refactorings

Having brain cramps today, ...

F1e3ab214a976a39cfd713bc93deb10f Talk
1
2
3
$.fn.grow_input = function() {
  return this.each(function() {
...

JavaScript Expanding input list using ...

by Billskog, January 04, 2009 09:05, No refactoring, tagged with jquery, javascript

The idea is to have a expan...

1d61786256cde4ad5a3afb2f1ff3812b Talk
1
2
3
4
/* 	study_2008.001.02_field_control.js

    See: http://gregelin.com/studies/study_2008.001.02
...

JavaScript Streamline attaching onPast...

by gregelin.myopenid.com, January 03, 2009 16:36, No refactoring, tagged with javascript prototype forms

Can the following be stream...

57f954ba5409a6504af785ed8d42e009 Talk
1
2
3
int x, y;
...

C# Which is more readable? Mat...

by cohen.myopenid.com, January 02, 2009 16:43, 1 refactoring, tagged with Math.Max, Math.Min, if

I see a lot of code like in...

49c552e21b2fcbff0ff6567507ef1715 Talk
1
2
3
4
class Light
  def initialize(location)
    @location = location
...

Ruby Command Pattern from Head F...

by Rubén Dávila, January 02, 2009 14:09, 1 refactoring, tagged with ruby, patterns, design

Example in Ruby of Command ...

0e34c56054c414263e933a1b8b3d0d55 Talk
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

Can you rewrite this onelin...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
grammar Expr;
options {
	backtrack=true;
...

Java ANTLR / Java

by congofreestate.blogspot.com, December 25, 2008 00:21, 1 refactoring, tagged with antlr

This is a mix of ANTLR ( ht...

Avatar Talk
1
2
3
4
brew = "rdadadroxmocpronogomocdmqzx"
alphabet = "abcdefghijklmnopqrstuvwxyz"
word = ""
...

Ruby Newb needs some cleanup

by redpidgin, December 23, 2008 16:16, 7 refactorings, tagged with short, ruby, decode

Some code I've written for ...

5ce36f73f075f18632c284f56cedd23d Talk
1
2
3
4
def with_infinity(date_unit)
  limit = 20
  (date_unit..Inf).each do |x|
...

Ruby RSpec example does not cont...

by Ollie , December 22, 2008 01:33, 4 refactorings, tagged with rspec, bdd

This piece of code specifie...

Be072eb0e9f6f81c20541150cabce3ab Talk
1
2
3
4
#include <iostream>
using namespace std;

...

C++ while reads some integers a...

by buk, December 18, 2008 21:50, 4 refactorings

hi,

first time here dont...

690d76ede81cf142565ee77b2f507bb4 Talk
1
2
3
class SteamController < ApplicationController
...

Ruby Doing it wrong? ScRUBYt

by sfusion.myopenid.com, December 18, 2008 19:37, 3 refactorings

Can't help but feel I might...

4f5d54213efb6502baab202f3fb2f09e Talk
1
2
3
4
def space_out_camel_case(stringAsCamelCase):
    """Adds spaces to a camel case string.  Failure to space out string returns the original string.
    >>> space_out_camel_case('DMLSServicesOtherBSTextLLC')
...

Python CamelCase to Camel Case (Py...

by bigsassy.myopenid.com, December 18, 2008 19:06, 1 refactoring, tagged with short, snippet, camelcase, camel case, re, regular expression

Hi, I'm a python newbie. C...

Cc4c514481dbf2cf9f602188dee3c212 Talk
1
category_id = category_name.scan(/category-(\d+)/)[0][0]

Ruby Ugly RegEx Accessor

by sebastian.deutsch.myopenid.com, December 18, 2008 12:39, 9 refactorings, tagged with regex

I try to extract an id from...

Avatar Talk
1
2
3
4
  require 'rubygems'

  require 'hpricot'
...

Ruby Screen Scraping Google with...

by zigx.myopenid.com, December 18, 2008 00:48, 7 refactorings, tagged with ruby, hpricot, watir, google, scrape

Would love to see a COOLer ...

Ff9eefc6ed72560c262b0e125151ea7c Talk
1
2
3
4
# sum an an array's elements
def sum_row(a)
  sum = 0
...

Ruby Conditionally deleting colu...

by srboisvert.myopenid.com, December 18, 2008 00:18, 4 refactorings, tagged with ruby, csv, array

I needed to read in a CSV f...

12d6a2e5971e661ee2bf2994526e848d Talk
1
2
3
4
def run_once &block
  path = File.expand_path caller.first
  unless ($__run_once ||= []).include? path
...

Ruby Run once

by Tj Holowaychuk, December 16, 2008 21:30, 9 refactorings

Cleaner way?

F1e3ab214a976a39cfd713bc93deb10f Talk
1
2
3
4
# Jhippo.java

package Jhippo;
...

Java Jhippo

by tak11.myopenid.com, December 16, 2008 04:14, No refactoring, tagged with pircbot, java, irc, bot, swing, gui

Java irc bot using Pircbot....

42306c1a1e87611519fdf1811ffe2c9c Talk
1
2
3
4
      #!/usr/bin/perl
      #smtp scanner by Tak
...

Perl Smtp Scanner

by tak11.myopenid.com, December 16, 2008 04:07, No refactoring, tagged with smtp, scanner, port, perl

I wrote this a LOONGG time ...

42306c1a1e87611519fdf1811ffe2c9c Talk
1
2
3
4
#!/usr/bin/perl -w
use strict;

...

Perl deldup

by tak11.myopenid.com, December 16, 2008 03:54, No refactoring, tagged with password, perl, file

ment to cycle through a pas...

42306c1a1e87611519fdf1811ffe2c9c Talk
1
2
3
4
<?php
    function isvalid_url($url) 
    {
...

PHP check for valid url

by armano.myopenid.com, December 15, 2008 02:25, 6 refactorings, tagged with url

Hi everyone..is there other...

1cd9c8984f2fdeb996130d54d62a98d9 Talk