Skip to content

Instantly share code, notes, and snippets.

View randallreedjr's full-sized avatar

Randall Reed, Jr. randallreedjr

View GitHub Profile

To copy a Heroku ENV variable from one application to another, from a bash shell, run

heroku config:set MY_VAR="$(heroku config:get MY_VAR --app old-app-name)" --app new-app-name
randallreedjr /
Last active February 4, 2024 17:36
How to add comments to Markdown

There are comments here but you can't see them

Below this ↓

And above this ↑

randallreedjr / spec_helper.rb
Created January 30, 2019 18:04
Rspec focus tag by default
# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
config.filter_run :focus
config.run_all_when_everything_filtered = true


Verify latest Ruby version

Ruby downloads

Check local Ruby version (CLI)

$ ruby -v

If necessary, upgrade Ruby (CLI)

$ rvm get stable
randallreedjr /
Last active April 25, 2024 07:06
Add a Heroku remote to an existing git repo

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.

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. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging
randallreedjr /
Last active December 30, 2016 02:08
Convert a screen recording to an animated gif
$ ffmpeg -i -s 600x400 -pix_fmt rgb24 -r 20 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif
$ ffmpeg -i -pix_fmt rgb24 -r 10 out3.gif
randallreedjr /
Created December 29, 2016 20:13
Syntax Highlighting for Presentations
$ brew install highlight
$ highlight -w
$ highlight -s anotherdark -O rtf src/HelloWorld.js | pbcopy
/* eslint-disable import/no-extraneous-dependencies */
import { shallow, mount } from ‘enzyme’;
/* eslint-enable import/no-extraneous-dependencies */
randallreedjr / .elsintrc.js
Created October 13, 2016 14:50
ESLint config file extending local configuration
module.exports = {
  “extends”: “../src/.eslintrc.js”,
  “rules”: {
  “import/no-extraneous-dependencies”: “error”
randallreedjr / replaceText.js
Last active May 18, 2016 22:38
Javascript string replace
replaceText = function(string, oldText, newText) {
index = string.indexOf(oldText);
front = string.substring(0, index);
back = string.substring(index + oldText.length);
return front + newText + back;
replaceTextGlobal = function(string, oldText, newText) {
while(string.indexOf(oldText) >= 0) {
string = replaceText(string, oldText, newText);