1 2 3 4
#!/bin/ruby characters_to_use="ABCD" ...
Ruby brute-force password cracker
by Nathan,
October 10, 2008 22:29,
1 refactoring, tagged with password, brute-force, crack, combination, permutation
1 2 3 4
def translation_links lang = [ %w[en english us], ...
Ruby nested array to set of html...
i have a simple array that ...
1 2 3 4
WEEKDAYS = %w(mon tue wed thu fri sat sun) dates = [ ...
Ruby Open hours grouping
Actually I really don't kno...
1 2 3 4
class SearchNestedHashByValue def key_for(h, str, trail=[]) h.each_pair do |k, v| ...
Ruby Search nested hash
Search nested hash on their...
1 2 3 4
#controller def search if params[:search] ...
Ruby Search with fulltext, ago-c...
by papricek.myopenid.com,
October 07, 2008 12:52,
3 refactorings
How would you make this cod...
1 2 3 4
def writefile(file, *linedata) linedata.each do |line| file << line.join(",") + "\n" ...
Ruby Parsing non-delimited text
I have large text-reports f...
1 2 3 4
def redirect_to_current_user if params[:id] != current_user.login if params[:action] == "show" ...
Ruby Before Filter URL Redirect ...
I'm using to_param to pass ...
1 2 3 4
$LETTER = Hash[*%w/ A .- N -. B -... O --- ...
Ruby Morse Code Encoder/Decoder
I'm trying to improve my Ru...
1 2 3 4
#!/usr/bin/env ruby # == Synopsis ...
Ruby Source code analysis
by Tj Holowaychuk,
September 26, 2008 03:04,
3 refactorings
Small class to analyze scri...
1 2 3 4
FIELDS = [ 'first', 'last', 'band' ] DATA = [['Kurt', 'Cobain', 'Nirvana'], ['Jimi', 'Page', 'Led Zeppelin'], ...
Ruby Map fields array and data a...
First posting here. I just ...
1 2 3
# Simple method to calculate the square of a number
...
Ruby Conditional Assignment
This is a tiny bit of code ...
1 2 3 4
class Listing < ActiveRecord::Base require_dependency "listing/property_related" require_dependency "listing/price_related" ...
Ruby require_dependency
by Tien Dung,
September 18, 2008 01:08,
3 refactorings
Rails require_dependency usage
1 2 3 4
for feedback in @feedbacks unless feedback.question1.nil? data[0][feedback.question1.to_i - 1] += 1 ...
Ruby Horrible loop
by toggo.myopenid.com,
September 17, 2008 09:51,
5 refactorings
Can anyone help refactor th...
1 2 3 4
# This is what an application build with our framework would look like. # Run with: # rackup app.ru ...
Ruby Very Simple Rack framework
I'll be presenting http://r...
1 2 3 4
x = 'My String' x.kind_of? String # => true ...
Ruby x.kind_of? MyClass or x.cla...
It seems like these two are...
1 2 3
<%= link_to 'New page', new_page_path %>
...
Ruby Sorting a navigation tree u...
I have something, working r...
1 2 3 4
def custom_pagination(num_item, per_page, current_page) num_page = (num_item/per_page.to_f).ceil arr_page = [] ...
Ruby ActiveRecord object custom ...
Hello everybody,
I'm beg...
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
module Enumerable # Sorts the enumeration by mapping the # values in the enumeration through the given block. ...
Ruby sort_by_multiple
require "benchmark"
data_s...
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,
2 refactorings, tagged with rails, chart, sumary
Give a count or sum group o...
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...
Just a quick-and-dirty for ...