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.

Adding a new remote

Add a remote for your Staging app and deploy

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


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.

This article is definitely an interesting read, but what interested me the most was the function at the end, one which far surpassed the others in term of performance.

Here is the function:

function multMath(n) {…


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('-')
facepalm

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.


source: https://www.pexels.com/photo/laptop-calendar-and-books-908298/

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.new
NameError (uninitialized constant Date
Did 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. …


source https://www.pexels.com/photo/man-in-white-shirt-using-macbook-pro-52608/

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. …


Image credit: http://in3xplicit.deviantart.com/art/DESTINY-QHD-280077385

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
end
end

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…


How we used to share things. Image credit: https://www.pexels.com/photo/white-compact-disc-93388/

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…


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…


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…


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

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store