# Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. `heroku create`. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Note: This article began as a GitHub Gist and grew from there with helpful input from other GitHub users, as cited below.

Note that on Heroku, you must always use `master` as the destination branch on the remote. …

# Exploring the Math Behind an Innovative Code Solution

Consider the following coding challenge:

Return the sum of all multiples of 3 or 5 that are below a number N, where N is an input parameter to the function

When writing software, there is no single correct answer. The author of the article below explores six different solutions to the aforementioned problem, working through the thought process behind iterating towards a final solution.

Here is the function:

`function multMath(n) {…`

# Ruby’s String#delete and Boolean Algebra

How can learning about the String#delete method in Ruby help us understand Boolean Algebra?

## It starts with a misuse of gsub

I cannot tell you how many times have I written code like

`'abc-de'.gsub('-','')`

when I could have just written

`'abc-de'.delete('-')`

Fortunately, Stack Overflow was there to educate me. Not only is `delete` more semantic and concise than `gsub` for removing a single character, it gets even better with more complex deletions.

# Nine Interesting Tidbits About Dates In Ruby

Note: This article sat in my drafts folder for a long time. I recently had to look up how to determine the weekday-ness of a date, so I decided to finally give this a publish.

1. To use Date objects in Ruby, you must require the ‘date’ library.

`# ruby-2.5.0> Date.newNameError (uninitialized constant DateDid you mean?  Data)> require 'date' => true> Date.new => #<Date: -4712-01-01 ((0j,0s,0n),+0s,2299161j)>`

Unsurprisingly, Date is already included in Rails.

2. `Date.new` takes arguments in the order year, month, day — the same order as ISO 8601. …

# Intermittent Test Failures with FactoryBot, Faker, and Apostrophes

I love Factory Bot. It allows for simple, repeatable creation of objects for testing, as well as semantic naming. You can have an `invitation` factory, a `pending_invitation` factory, and an `accepted_invitation` factory, and immediately you have some context about the object you’re working with.

Faker really takes FactoryBot to the next level. Instead of populating object attributes with arbitrary strings, you can specify an object type that is representative of the data you would expect (e.g. a Name, a Number, or a Business). The wide array of object types you can generate is truly staggering. …

# Nil and Presence in Ruby on Rails

One of the things I love about Ruby is `nil`. It can represent nothing and, since every expression in Ruby has a return value, `nil` is also a useful proxy for certain behavior.

For example, `nil` can represent that a variable was never assigned a value, or that a method never executed any statements.

`def method_that_might_do_something(some_condition)  if some_condition    // do some stuff    return true  endend`

When an `if` statement’s condition is fulfilled, that `if` statement returns the return value of the last expression evaluated inside the block. However, if the condition fails, the `if` statement returns `nil`.

So if…

# Sharable ESLint Config

I had been working on a new React project, and setting up our ESLint linter, when I came across an irksome linter error:

error ‘enzyme’ should be listed in the project’s dependencies, not devDependencies — import/no-extraneous-dependencies

I am importing shallow and mount from enzyme, but they are certainly not runtime dependencies. How to make eslint understand that? As with any vexing linter rule, the easiest approach is just to disable it.

I don’t want to have to remember to add these lines every time.

But then, as I added more test files, I thought, “I don’t want to have…

# Why I Switched from Sublime to Atom

A programmer’s text editor is a very personal choice. I will always look back fondly on the time Sublime Text and I spent together, but eventually we grew apart. Now there’s a new text editor in my life, and I couldn’t be happier.

## Before Sublime, I didn’t know what I was missing

Writing Ruby in Sublime Text 2 was my first time using a modern text editor. Before I became a web developer (back in my Visual Studio days), I thought upgrading Notepad to Notepad2 or Notepad++ was all I could ever need.

Look that those line numbers! It highlights matching parens!

-A naive me

Then I was introduced…

# Declarative Programming in Ruby

I’ve been programming in Ruby for almost two years now, and sometimes I forget how hard it was for me to wrap my head around the Ruby approach to solving problems. Finally, Tyler Mcginnis has given me the vocabulary to describe the paradigm shift I experienced — Imperative vs Declarative code.

With imperative code, you’re telling your program how to do something. And with declarative code, you’re telling your program what you want to do.

-Tyler Mcginnis, React Fundamentals

Coming from a C++ background, I was used to imperative programming; those mental pathways were well-trodden. Although Ruby can be used…

# How do you build a connected distributed team?

Technology is changing the way we work. Remote and contract developers for hire are becoming more prevalent. While there are certainly benefits to these staffing solutions — economic savings, convenience, access to a larger talent pool — there is also an undeniable challenge.

Humans as a species thrive on connection, and engagement is central to connection. But when you don’t share the same physical space with your coworkers Monday to Friday, accompanied by the coffee room chats, lunch outings, and downtime inside jokes, how do you foster “teamness”? Since joining Cyrus Innovation, I have felt very connected to the team,despite…

## Randall Reed, Jr.

Learning Ruby and building stuff. Developer at @degreed, based in Richmond, VA.

Get the Medium app