1 2 3 4
def save_feed @feed = FeedTools::Feed.open('http://losangeles.craigslist.org/apa/index.rss') @feed.items.each_with_index do |item,i| ...
Ruby RSS model method
Its very simple method whic...
1 2 3 4
class WhoIsQuery query = ARGV[0] puts "Querying whois with #{query} ..." ...
Ruby Whois refactoring
I'm new to ruby and I make ...
1 2 3 4
class Article < ActiveRecord::Base # Find all articles in the given date range based on the published_at field ...
Ruby Building a dynamic date range
I've got a route that handl...
1 2 3 4
using System; using System.Collections.Generic; using System.Linq; ...
C# Pointers in C#
I am trying to work out how...
1 2 3 4
#!/bin/bash for ((i=0;i<=17;i+=1)) do ...
Bash For Loop using Awk
by roxannspencerolsen.blogspot.com,
May 08, 2008 20:38,
1 refactoring
I an working on a script th...
1 2 3 4
import java.util.Scanner; public class AsciiSquare ...
Java ascii square
by kefestetayyus.blogspot.com,
May 09, 2008 12:44,
No refactoring, tagged with java, ascii, square, basic
Simply prints a square with...
1 2 3 4
<% @purchase_order.grants.each do |grant| %> <table> <tbody> ...
Ruby Please help me simplify thi...
Is there a way in Ruby to p...
1 2 3
class UserMailer < ActionMailer::Base def signup_notification(user) ...
Ruby before_filter in model???
I have to call the setup_em...
1 2 3 4
class CampaignsController < ApplicationController before_filter :load_campaign_or_redirect, :except => [:index, :sent, :new, :queued, :create, :processing] ...
Ruby Step-REST uuuuugly controller
by Pożycz Badge,
April 23, 2008 16:01,
2 refactorings
Proably it's possible to cl...
1 2 3 4
class VotingSystem #Hello, I am Rodger the old and unhappy programmer. the variable nbrOfVotes is an array of 2 dimensions. The first dimension contains the number of votes for the answer "YES, IT SUCKS"... and the other dimension contain the number of votes for the answer "NO, IT DOESN'T SUCK". In the near future there will be other possible answers... but I don't care! I retire in 2 days! @@nbrOfVotes = Array.new ...
Ruby Rubyize this : 6th edition
Ouch... this guy badly need...
1 2 3 4
def self.valid?(key) h=find_by_key(key) ...
Ruby Better Nest Ifs
by pcorral.myopenid.com,
April 13, 2008 03:02,
6 refactorings
Any idea about better code?
1 2 3 4
def hashify(object_array) h = Hash.new object_array.each do |x| ...
Ruby Less typing same functionality
I know this can be done but...
1 2 3 4
require 'erb' # GOAL: render the template with the following vars ...
Ruby Given a hash of variables, ...
by mislav,
April 12, 2008 15:12,
3 refactorings, tagged with erb, singleton, metaclass, metaprogramming, hash, render
This works. Now, is there a...
1 2 3 4
def assigned_to_id=(user_id) if user_id == "" if self.ticket_assigment != nil- ...
Ruby WTF
by prekitt.myopenid.com,
April 09, 2008 19:56,
1 refactoring, tagged with Ruby on rails activerecord
There's got to be a better ...
1 2 3 4
<?php if (count($argv) != 3) die("Usage: $argv[0] <RSS feed URL> <output dir>\n"); ...
PHP Download all audio enclosur...
Given an RSS feed and an ou...
1 2 3 4
void CopySourceTables(List<TableNameResult> tables, int id) { // Execute the "Copy" Command on the Server for Each Table. ...
C# Common StProc Code
Hi guys, following my previ...
1 2 3 4
bool Do_People_Still_Read_This { // Not sure what to put here? "return true;" or "return false;" ? ...
C# Since I Cannot Message Peop...
Didn't/couldn't see how to ...
1 2 3
class Race < ActiveRecord::Base ...
Ruby Help generating abbreviatio...
by Michael Filbin,
April 06, 2008 16:16,
2 refactorings, tagged with abbreviation, string, model, attribute
Hi all,
I am attempting ...
1 2 3 4
class JobBoard < ActiveRecord::Base has_many :job_board_postings ...
Ruby Ruby has_finder on has_many ?
This smells... one of the m...
1 2 3 4
from random import random as _ eval(compile("\n".join( ["(lambda %s:" % (chr((121 - ((25 - (ord("z") - y)))))) ...
Python Random number generator
It works okay, but I think ...
1 2 3 4
require 'benchmark' def euler_chain_size(start) ...
Ruby Euler 14
The problem description is ...
make_activation_code and ma...