1 2 3 4
module Actions attr_accessor :prefix ...
Ruby On instance extending problem
by Ben Marini,
July 18, 2010 20:56
1 2 3 4
require 'rubygems' require 'active_support' Foo = Struct.new(:id, :status_id, :profile_id) ...
1 2 3 4
module Bitmap def self.bgr_to_rgba(raw_bgr_array, width, height, new_dimension) width_padding = new_dimension - width ...
1 2 3 4
<?php // Benchmarks for writes and reads, separated. $times = 10000; ...
PHP On How should I optimize this ...
by Ben Marini,
December 08, 2009 08:13
Your benchmarking code is b...
1 2 3 4
class Channel < Struct.new(:name, :pages) end ...
Ruby On Can this be less clunky?
by Ben Marini,
November 30, 2009 17:26
I'm with Daniel, the source...
1 2 3 4
<?php // $id = Request::get("id"); class Request { ...
PHP On An easy one: traversing thr...
by Ben Marini,
November 16, 2009 17:15
I might be tempted to do so...
1 2 3 4
module Prototype klasses = { "com.utils" => [ 'guimodel.PresentationEntry', 'guimodel.PresentationGroup'], ...
1 2 3 4
def color_range(start,finish, intervals) range = Range.new(start[1..-1].hex, finish[1..-1].hex) incr = (range.last - range.first) / intervals ...
Ruby On Fading from one color to an...
by Ben Marini,
November 04, 2009 21:15
I think this does what you ...
1 2 3 4
<?php date_default_timezone_set("GMT"); ...
PHP On Determine whether it's day ...
by Ben Marini,
November 03, 2009 03:10
First off, your $latitude a...
Ruby On Adding an object with acces...
by Ben Marini,
October 11, 2009 20:50
Jim Weirich's builder gem f...
1 2
c = {} c[:label1] = MyObject.new("label1", "value1")
Ruby On Adding an object with acces...
by Ben Marini,
October 08, 2009 06:57
Is the only point of Object...
1 2 3 4
# Method 1 (Using ObjectContainer) obj = MyObject.new("label", "value") container = ObjectContainer.new ...
Ruby On Adding an object with acces...
by Ben Marini,
October 08, 2009 06:53
Seems to me like you might ...
1
@total_pages = total.quo(per_page).ceil
Ruby On Pagination total page count
by Ben Marini,
October 07, 2009 06:44
A variation that's arguably...
1 2 3 4
# Case 1: {comma,period} followed by exactly 3 digits and no occurrence of 4+ digits in a row # Case 2: {comma,period} followed by exactly N digits where N != 3 # Case 3: No commas or periods ...
Perl On Handling both dots and comm...
by Ben Marini,
October 03, 2009 02:56
Seems like all of these tes...
Ruby On Loop through Activerecord r...
by Ben Marini,
October 02, 2009 14:42
A little more code would he...



String is not outputting th...