1 2 3 4
module Enumerable # Sorts the enumeration by mapping the # values in the enumeration through the given block. ...
Ruby sort_by_multiple
1 2 3
feed = RssParser.run("http://ws.audioscrobbler.com/1.0/user/me/recenttracks.rss") song1 = feed[:items][0][:title] ...
Ruby Think this needs a loop
Im new to Ruby, I think it ...
1 2 3 4
function create_link($string) {
$input = media_title($string);
...
PHP Prepare links - friendly URLs
by Memf,
September 04, 2008 05:57,
2 refactorings, tagged with php, short, friendly, friendly urls, url, URLs, prepare, code, memforis, function, memf, links, create link
Please help shorten the cod...
1 2 3 4
private string getMD5String(string PlainText) { System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create(); ...
C# Cryptography with MD5
This is a simple example of...
1 2 3 4
def time_summary(klass,group_operator,field,from,to,step) data_with_missing_counts(klass.find( :all, ...
Ruby Rails Active Record Time Su...
by sebastiana.myopenid.com,
September 03, 2008 14:31,
1 refactoring, tagged with rails, chart, sumary
Give a count or sum group o...
1 2 3
import System.IO import Data.Word ...
Haskell Raytracer in haskell
by jaggederest,
September 01, 2008 21:23,
No refactoring, tagged with haskell, raytracer, vector, linear algebra
This is my first serious ha...
1 2 3 4
#!/usr/bin/ruby DVD_SIZE=4294967296 CD_SIZE=734003200 ...
Ruby DVD Directory Archiver
by seal-7.blogspot.com,
September 03, 2008 14:26,
No refactoring, tagged with bash, shell, spaghetti, monkey patch
Originally made to move cal...
1 2 3 4
class Planet(object): all = [] @classmethod ...
Python Pythonify my code
The get method just doesn't...
1 2 3 4
-module(prime). -export([main/0, print_if_prime/0]). ...
Erlang Experimental Prime Number G...
by evilteach.blogspot.com,
September 03, 2008 14:28,
No refactoring
I wrote this as an exercise...
1 2 3 4
def test_web_browser() if request.env["HTTP_USER_AGENT"][/Firefox\/3/]=="Firefox/3" return "Firefox3" ...
Ruby Code to detect the web browser
by dcadenas.blogspot.com,
August 28, 2008 17:19,
16 refactorings
This is not my code but I w...
1 2 3 4
data = data.gsub("\xA0", " ") data = data.gsub("\x99", "(TM)") data = data.gsub("\x97", "-") ...
Ruby simplify multiple gsub
I could put the search/repl...
1 2 3 4
try: if options.input_file: infile = open(options.input_file, 'r') ...
Python Your average file filter...
by agnul,
August 27, 2008 17:22,
4 refactorings
From the useless speculatio...
1 2 3
comment_type = translation.class.to_s == "Project" ? "project" : "header" if comment = translation.find_comment_by_type(comment_type) ...
Ruby Too many assignments and co...
This seems like a very long...
1 2 3 4
desc 'Prints out the status codes and their named symbols. Limit by specifying `code=`, with one or more digits or with the start of a named code.' task :status_codes do require 'action_controller/status_codes' ...
Ruby A Rails rake task to lookup...
This is a rake task that wi...
1 2 3 4
using System.Security.Cryptography; public class CryptographyRSA() ...
C# Cryptography with RSA and B...
This is a simple example of...
1 2 3 4
#!/usr/bin/python # -*- coding: utf-8 -*- ...
Python Query TinyUrl the fastest way
I'm looking for the fastest...
1 2 3 4
#!/usr/bin/python # -*- coding: utf-8 -*- ...
Python Base64 image encoding and i...
Is this a correct a way to ...
1 2 3 4
#!/usr/bin/python # -*- coding: utf-8 -*- ...
Python Parse XML from Yahoo weathe...
Is there a more efficient w...
1 2 3 4
<?php class PropertyHandler { ...
PHP Base class for easy class p...
This class lets you handle ...
1 2 3
class Administration::ReportsController < Administration::HomeController ...
Ruby has_many :through collectio...
by kain,
August 30, 2008 01:53,
No refactoring, tagged with Ruby on Rails, rails, ruby, has many through
This is an attempt to make ...
1 2 3 4
-module(prime). -export([main/0, print_if_prime/0]). ...
Erlang Experimental Prime Number G...
The is the results of an ex...
1 2 3
<%if @user.city.blank?%>
...
Ruby Default value for user column
by DG,
August 19, 2008 08:57,
5 refactorings
Hi,
- In users table city ...
1 2 3 4
def ask_words array = [] puts 'Enter words, blank row quits.' ...
Ruby Method for sorting
This is exercise from Chris...
1 2 3 4
class Test @@tries=0 attr_reader :num ...
Ruby Code transactions
In a Rails controller I'm s...
require "benchmark"
data_s...