April 4, 2015 by Daniel P. Clark

Getting Started with MiniTest

Whet ever you may believe about testing practices; tests still provide some peace of mind and clarity in projects.  Also; if you build a library for others to use, tests are a form of validation of your work and provide trustworthiness to your code.  In the case of working with a large project that is…

Continue Reading »

March 31, 2015 by Daniel P. Clark

Rails 4’s Awesome enums

In Rails 4 enum was introduced to support a feature that people were building by hand or by gem.  What enum does for you is it associates a symbol list for you to reference which will be stored in the database as an integer.  So :cow could be 0 and :dog could be 1 in…

Continue Reading »

March 26, 2015 by Daniel P. Clark

Different Collection Types in Ruby

In computer science, a collection or container is a grouping of some variable number of data items (possibly zero) that have some shared significance to the problem being solved and need to be operated upon together in some controlled fashion. – Wikipedia In Ruby the most common collection types used are known as Array and…

Continue Reading »

March 20, 2015 by Daniel P. Clark

Hooks

When trying to ensure that something happens around some kind of event it’s usually best if you work with a hook designed for that scenario rather than manually implementing one.  This becomes most evident in JavaScript events with jQuery and Bootstrap effects.  If you write an event listener for some change around these effects without…

Continue Reading »

March 15, 2015 by Daniel P. Clark

More UJS fun with Accordion Content

I’ve already covered loading Bootstrap modals directly from the server on Rails with UJS in this blog post: Discovering UJS with AJAX.  Now I’d like to continue from there and demonstrate Bootstrap’s accordion feature with content loaded directly from the server.  We’ll use a personal profile example where you click on an expansion link to…

Continue Reading »

March 12, 2015 by Daniel P. Clark

Substitution with Regex Groupings

As I continue to grow in experience I was looking into how I might do some in-place substitution that I had been accustomed to performing with array matching (split-map-join).  What I’m referring to isn’t just a letter for letter substitution, but something that would find a match and modify it.  For example; if I wanted…

Continue Reading »

March 9, 2015 by Daniel P. Clark

Ruby: Actionable Meta

The more you program the more likely you will need to change a string to the object the string represents. For example you may have a string with a mystery class name in it the you need to call methods on. Lets go a step further, lets say the method you need to call on…

Continue Reading »

March 7, 2015 by Daniel P. Clark

Configuration With a Singleton Instance

I was considering how I might want to further implement my gem and incorporate configuration settings for it.  I wanted only one instance of my configuration and it needed to be part of my module.  So I’ve come up with a solution I like that allows me to do this and even have a true…

Continue Reading »

March 6, 2015 by Daniel P. Clark

Numeric Bases and Defining Your Own

Lately I’ve been teaching my niece a new way to do math.  She would have difficulty with addition and subtraction of numbers if they contained more than a few digits.  I asked her if she’d ever seen a clock where the numbers rolled over (like in the movie Ground Hog Day).  She hadn’t.  I decided…

Continue Reading »

March 3, 2015 by Daniel P. Clark

Ruby: The Case for Case

It’s nice to have case and when available in Ruby.  But I don’t see it used too often.  I myself don’t use it much because I’m more accustomed to just using if and else.  So let’s get into case switching. person = “employee” case person when “boss” puts “Yes sir!” when “employee” puts “Sure I’ll…

Continue Reading »

Page 4 of 8
1 2 3 4 5 6 8
1 2 3 4 5 6 8