March 7, 2016 by Daniel P. Clark

Make the Impossible Possible

[Don’t Listen to the Naysayers.] How many times have you heard that you can’t do this and you can’t do that and it’s never been done before? I love it when someone says that no one has ever done this before, because then when I do it that means that I’m the first one that has…

Continue Reading »

February 2, 2016 by Daniel P. Clark

Ruby: Bindings Across Inheritance

One thing you will find yourself needing to do is work across different scopes and in different ways.  I would like to show one way of modifying local variables by passing a Binding object. Let’s say you’re going to write encryption classes and you’ll have different ways of encrypting and decrypting.  For these you will have…

Continue Reading »

January 13, 2016 by Daniel P. Clark

101 Ruby Code Factoids

0) ‘methods’ method Since almost everything in Ruby is an Object you can type dot methods on it to see what methods are available. 4.methods – Object.methods # => [:-@, :+, :-, :*, :/, :div, :%, :modulo, :divmod, :fdiv, :**, :abs, :magnitude, :~, :&, :|, :^, :[], :<<, :>>, :to_f, :size, :bit_length, :zero?, :odd?, :even?,…

Continue Reading »

November 27, 2015 by Daniel P. Clark

Iterative Evaluation

In computer programming, an iterator is an object that enables a programmer to traverse a container, particularly lists. [1][2][3] -Wikipedia Gatcomb, Joshua. “Understanding and Using Iterators”. Perl.com. Archived fromthe original on 2005-06-16. Retrieved 2012-08-08. A user-defined iterator usually takes the form of a code reference that, when executed, calculates the next item in a list…

Continue Reading »

November 13, 2015 by Daniel P. Clark

Implement a Lazy Hash in Ruby

I use the term Lazy Hash in the same way you would call an Enumerator a lazy iterator.  That being; the values don’t get evaluated until they are needed.  In a Hash this is also utilizing memoization, where the value gets assigned the first time it’s used.  E.G. @variable ||= :value Let’s say you own…

Continue Reading »

November 13, 2015 by Daniel P. Clark

Rails Rumble – the Experience

Rails Rumble is a yearly programming challenge.  Each team is given 48 hours to complete and publish a website written in Ruby.  You are permitted solo entry or up to 4 people as a team.  You can do no coding of the project beforehand, but you can draw up and discuss plans as much as…

Continue Reading »

September 21, 2015 by Daniel P. Clark

Introspection by Design in Ruby

If I have one pet peeve in Ruby it’s knowing state at a certain point in the program’s process.  Sure they make plugins for advanced diagnosis of this.  And when you start out learning to program it’s common practice to use puts everywhere to see what’s going on.  But this causes a lot of back…

Continue Reading »

June 21, 2015 by Daniel P. Clark

Ruby Refinements – Not quite ready for production

I recently looked for a method on Array for a boolean response on its uniqueness.  As Ruby currently doesn’t have one I figured it’s easy enough to write one.  Now Ruby’s refinements are fairly new and a nice feature to have around.  So I decided to write a benchmark for different ways to test the…

Continue Reading »

May 28, 2015 by Daniel P. Clark

Rails’ HashWithIndifferentAccess

A Ruby Hash is a very powerful collection type to use in Ruby.  When working in Rails sometimes you’ll have symbols as keys or sometimes they will be strings.  If you use a normal Hash these will store as different keys for the same name. sample = Hash.new sample[:a] = 1 sample[“a”] = 2 sample…

Continue Reading »

May 16, 2015 by Daniel P. Clark

Switching From Unicorn to Puma on Heroku is Easy!

I’ve had my project running on Heroku with Unicorn for some time now.  Not that long ago Heroku put out a notice advising people to switch over to Puma as Unicorn doesn’t do well with low latency connections.  And you know that with the internet you’re always going to have people with slow connections accessing…

Continue Reading »

Page 2 of 8
1 2 3 4 8
1 2 3 4 8