January 12, 2017 by Daniel P. Clark

Re: What is the splat operator doing here?

I’ve received an email from a fellow software developer inquiring about a bit of code where I use Ruby’s splat operator in two different ways.  In my Ruby gem cards_lib I wrote a “macro” to take a list of strings and generate card instances from them.  You don’t really hear of macros in the Ruby community…

Continue Reading »

July 1, 2016 by Daniel P. Clark

5+ Linux Video Editing Tool Tips

Finding a video editor in Linux that isn’t severely handicapped or come with an extreme learning curve is difficult.  But this article isn’t about fancy video editors.  As it turns out many of the things you need to get done are easiest with a few command-line tools.  The packages you’ll want to install are mpv,…

Continue Reading »

May 29, 2016 by Daniel P. Clark

How to Build the Ultimate Remote Pair Programming Environment

There are a handful of desktop sharing apps out there and there are plenty of shell/editor sharing setups.  But the biggest problem with these is you are opening up your own personal computer to not only the person(s) you’re connecting with, but also the potentially vulnerable or malicious technology you choose to use.  A proper…

Continue Reading »

April 21, 2016 by Daniel P. Clark

Encrypted Linux Backup with Google Drive and Duplicity

When it comes to protecting your important data it’s best to have at least 3 copies of your things backed up.  One should be air-gapped (not actively connected) and another be offsite (not at the same building).  The air gap will protect against malicious code that would encrypt all your files and force you to…

Continue Reading »

April 21, 2016 by Daniel P. Clark

Use Ruby’s Refinements Anywhere With An Anonymous Class

For a long time I’ve been looking for a way to use Ruby’s refinements without building a class & method setup and then instantiating an instance of the class just to use it. And now I’ve finally found a solution. module Moo refine Fixnum do def to_s “moo” end end end # begin/end blocks allow…

Continue Reading »

March 22, 2016 by Daniel P. Clark

Rails: Has One Through Polymorphic Relation

As I’ve described in my blog post “Rails Polymorphic Associations” I’ve stated that polymorphic relations in Rails are best for scenarios where a model may “belong to” one of many other kinds of model.  So a Comment model with the polymorphic commentable relationship can belong to any other record in your Rails app.  This is…

Continue Reading »

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 »

December 12, 2015 by Daniel P. Clark

Ruby: Arrays by Example

Arrays are Ruby’s most used collection type.  I will use very little description as I give examples for the many different ways to work with Arrays. Different ways to create an empty Array [] Array.new Array[] # same as :new Array(nil) # tries converting to an Array first and insures an Array result %w^^ #…

Continue Reading »

Page 2 of 11
1 2 3 4 11
1 2 3 4 11