def apply_credit(credit, tuple) num = tuple.shift ...
Ruby On apply a credit over an orde...
by Ben Marini,
October 23, 2011 19:18
class Animal
def queue_event
with_new_options do
...
Ruby On if/else with code duplication
by Ben Marini,
October 01, 2011 12:56
Why not let your subclasses...
class Node < Struct.new(:name, :parent)
def ancestors
parent.nil? ? [] : [ parent ] + parent.ancestors
...
# * Create a factory method for creating events. Make length required. # * Require start and end times for persistence. # * Don't allow length to be changed. It is confusing...should the start time ...
Ruby On Event: set end time based o...
by Ben Marini,
November 29, 2010 02:32
My thought is the interface...
module Actions attr_accessor :prefix ...
Ruby On instance extending problem
by Ben Marini,
July 18, 2010 20:56
String is not outputting th...
module Bitmap
def self.bgr_to_rgba(raw_bgr_array, width, height, new_dimension)
width_padding = new_dimension - width
...
<?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...
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...
<?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...
module Prototype
klasses = {
"com.utils" => [ 'guimodel.PresentationEntry', 'guimodel.PresentationGroup'],
...
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 ...
<?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...
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...
# 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 ...
@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...

Recursion seems to fit well...