Problem I’m golfing some code while waiting for a coworker, and I shortened a function to this: def get_data(dir) newest […]
Category: Ruby
Fractal generator
Problem Refer to the help message and title of this post for what the code does. I’m looking for tips […]
Using as few queries as possible for many table associations
Problem I have a table containing about 30k rows of data and there’s several table associations. The problem is that […]
Separate numbers with commas
Problem How should I approach refactoring this code? def separate_comma(number) a = number.to_s.split(”) b = a.size/3.0 if a.size < 4 […]
Dice roller in Ruby (mainly for D&D)
Problem I have been working with Ruby for about a week or two now, and I wanted to create a […]
Parent-child relationship
Problem I am implementing a parent-child relationship, represented by hashes that look like this: parent = { ‘parent’ => nil, […]
Most efficient FizzBuzz solution in Ruby
Problem I would appreciate any feedback concerning my analysis of the most efficient FizzBuzz solution programmed in Ruby. I submit […]
Quadratic equation solver in Ruby
Problem I wrote a simple quadratic equation solver with Ruby to help me solve quadratic equations. Please tell me what […]
Weekend Challenge: Ruby Poker Hand Evaluation
Problem I’m late to this weekend challenge (sorry), but since it’s all in good fun, I hope that’s ok. I’m […]
Finding if sequential numbers for total exists
Problem Question: Given a sequence of positive integers A and an integer T, return whether there is a continuous sequence […]