#!/usr/bin/env ruby1.8
#
# p0wn1e is the hackerspaces.org notifier.
...

Ruby ATOM feed to identi.ca stat...

by hellekin, September 12, 2009 02:00, 2 refactorings, tagged with ruby, bot, atom, feed, notification, identica, statusnet, twitter

I want to refactor this cod...

2cfbd4a81664e5d31b4b2fd0ace83c42 Talk
acts_as_nested_set
...

Ruby Refactoring of the location...

by Dmitry Polushkin, May 14, 2009 13:09, 1 refactoring, tagged with location selector

It's a Location selector, f...

832ed6ace46d61032151f4e1864c057f Talk
def date_range_by_week(selected_date)
  first_in_calendar = selected_date.beginning_of_month.next_week(:monday) - 7
  (first_in_calendar...(first_in_calendar+7*6)).to_a.in_groups_of(7)
...

Ruby On Splitting array into define...

by Marc-Andre, March 25, 2009 17:44 Star_fullStar_fullStar_fullStar_fullStar_full

And if you don't need those...

7f00244a6387413b37ee449f234ec045 Talk
def offset(selected_date)
  wday = selected_date.beginning_of_month.wday
  wday == 0 ? 6 : (wday - 1)
...

Ruby On Splitting array into define...

by Marc-Andre, March 25, 2009 17:26 Star_fullStar_fullStar_fullStar_full

I'm presuming you're coding...

7f00244a6387413b37ee449f234ec045 Talk

Ruby On Converting all umlaut chara...

by Marc-Andre, March 17, 2009 19:52

@Tj: Bit-shifting? For all ...

7f00244a6387413b37ee449f234ec045 Talk
class Asset < ActiveRecord::Base
  belongs_to :account
  belongs_to :asset_type
...

Ruby On Advanced search form & ...

by Marc-Andre, March 17, 2009 15:45

I'd use a naming convention...

7f00244a6387413b37ee449f234ec045 Talk
class String
  # returns an array of unicode codepoints, in canonical order
  def split_codepoints
...

Ruby On Converting all umlaut chara...

by Marc-Andre, March 17, 2009 14:48 Star_fullStar_fullStar_fullStar_fullStar_full

There are way more accents ...

7f00244a6387413b37ee449f234ec045 Talk

Ruby On Too many for loops

by Dmitry Polushkin, February 25, 2009 05:43

Why do you think is it bad?

832ed6ace46d61032151f4e1864c057f Talk
var next = false;
for (var i = 0; i < el.options.length; i++) {
  if (next) {
...

JavaScript Check next option in select...

by Dmitry Polushkin, January 25, 2009 15:04, 5 refactorings, tagged with select, options, increment, next

Could be written in plain j...

832ed6ace46d61032151f4e1864c057f Talk

Ruby On While loop to get unique value

by Dmitry Polushkin, January 22, 2009 10:06 Star_fullStar_fullStar_fullStar_fullStar_full

What about magic number '8'?

832ed6ace46d61032151f4e1864c057f Talk
%x[ls]

Ruby On Slurping popen

by Dmitry Polushkin, January 22, 2009 10:01
832ed6ace46d61032151f4e1864c057f Talk
def create_vouchercode
  begin
    self.vouchercode = generate_vouchercode(8)
...

Ruby On While loop to get unique value

by Marc-Andre, January 13, 2009 01:49 Star_fullStar_fullStar_fullStar_fullStar_full

...and if you favor using a...

7f00244a6387413b37ee449f234ec045 Talk
# Add this to spec/spec_helper.rb
# Use as:
#   check_route_for(:route_name => 'foo', :route_path => '/foo/:bar/baz/:quuq', :controller => 'foo', :action => 'foos', :bar => 'BAR', :quux => 'Moo')
...

Ruby On route spec'ing

by hellekin, October 28, 2008 14:52

This version is more solid

2cfbd4a81664e5d31b4b2fd0ace83c42 Talk
def interpreted_route_path(path, params)
...

Ruby On route spec'ing

by hellekin, October 27, 2008 23:00

Here is the final final ver...

2cfbd4a81664e5d31b4b2fd0ace83c42 Talk
@route_hash = { :controller => controller, :action => action }.merge(options)

Ruby On route spec'ing

by hellekin, October 27, 2008 22:37

Hmmm line 13 is wrong!

2cfbd4a81664e5d31b4b2fd0ace83c42 Talk
def interpreted_route_path(path, params)
    path.gsub(/:([^\/]+)/) { |b| params[$1.to_sym] }
  end
...

Ruby On route spec'ing

by hellekin, October 27, 2008 22:31

So, here's the final versio...

2cfbd4a81664e5d31b4b2fd0ace83c42 Talk
def interpreted_route_path(path, params)
...

Ruby On route spec'ing

by hellekin, October 27, 2008 22:17

Ok, here's one solution, bu...

2cfbd4a81664e5d31b4b2fd0ace83c42 Talk
def interpreted_route_path(path, params)
...

Ruby On route spec'ing

by hellekin, October 27, 2008 22:16

Ok, here's one solution, bu...

2cfbd4a81664e5d31b4b2fd0ace83c42 Talk
>> path
=> "/:foo/bar/:baz"
...

Ruby route spec'ing

by hellekin, October 27, 2008 22:00, 6 refactorings, tagged with ruby rails routes

I'm trying to extract a pat...

2cfbd4a81664e5d31b4b2fd0ace83c42 Talk

Ruby On Conversion from the 2d arra...

by Dmitry Polushkin, October 22, 2008 18:21

Something like I have writt...

832ed6ace46d61032151f4e1864c057f Talk

Ruby On Conversion from the 2d arra...

by Dmitry Polushkin, October 22, 2008 14:24

@danielharan: is it faster ...

832ed6ace46d61032151f4e1864c057f Talk
res = path_without_calculation.scan(/\{(.*?)\}/).flatten

Ruby On Extract text between {} bra...

by Dmitry Polushkin, October 22, 2008 14:20 Star_fullStar_fullStar_fullStar_fullStar_full
832ed6ace46d61032151f4e1864c057f Talk

Ruby On Conversion from the 2d arra...

by Dmitry Polushkin, October 22, 2008 14:17

Thanks! Why no "to_h" metho...

832ed6ace46d61032151f4e1864c057f Talk
class Array
  def to_h
    hash = {}
...

Ruby Conversion from the 2d arra...

by Dmitry Polushkin, October 22, 2008 09:11, 7 refactorings, tagged with convert, hash, 2d array

Conversion from the 2d arra...

832ed6ace46d61032151f4e1864c057f Talk

Ruby On Open hours grouping

by Dmitry Polushkin, October 16, 2008 06:20

I have some idea how to imp...

832ed6ace46d61032151f4e1864c057f Talk