Skip to content

Instantly share code, notes, and snippets.

Randall Reed, Jr. randallreedjr

Block or report user

Report or block randallreedjr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@randallreedjr
randallreedjr / MarkdownComments.md
Last active Jun 20, 2019
How to add comments to Markdown
View MarkdownComments.md

There are comments here but you can't see them

Below this ↓


And above this ↑

@randallreedjr
randallreedjr / spec_helper.rb
Created Jan 30, 2019
Rspec focus tag by default
View spec_helper.rb
# 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
View new_rails_app.md

Basic

$ rails new my-app

With rspec (no tests)

$ rails new my-app -T
# gem 'rspec-rails'
$ bundle install
@randallreedjr
randallreedjr / heroku-remote.md
Last active Dec 3, 2019
Add a Heroku remote to an existing git repo
View heroku-remote.md

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 https://git.heroku.com/staging-app.git
@randallreedjr
randallreedjr / animated-gif.sh
Last active Dec 30, 2016
Convert a screen recording to an animated gif
View animated-gif.sh
$ ffmpeg -i hello-name-user-data.mov -s 600x400 -pix_fmt rgb24 -r 20 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif
$ ffmpeg -i hello-name-user-data.mov -pix_fmt rgb24 -r 10 out3.gif
@randallreedjr
randallreedjr / highlight.sh
Created Dec 29, 2016
Syntax Highlighting for Presentations
View highlight.sh
$ brew install highlight
$ highlight -w
$ highlight -s anotherdark -O rtf src/HelloWorld.js | pbcopy
View example_spec.js
/* eslint-disable import/no-extraneous-dependencies */
import { shallow, mount } from ‘enzyme’;
/* eslint-enable import/no-extraneous-dependencies */
@randallreedjr
randallreedjr / .elsintrc.js
Created Oct 13, 2016
ESLint config file extending local configuration
View .elsintrc.js
module.exports = {
  “extends: “../src/.eslintrc.js”,
  “rules”: {
  “import/no-extraneous-dependencies”: “error”
  }
};
@randallreedjr
randallreedjr / replaceText.js
Last active May 18, 2016
Javascript string replace
View replaceText.js
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);
@randallreedjr
randallreedjr / rails_engine.sh
Last active Apr 19, 2016
Useful options when generating a Rails engine
View rails_engine.sh
rails plugin new -OJT --skip-bundle --mountable --dummy-path spec/dummy
OJT prevents assets and test unit files being generated,
skip bundle because you're going to be adding rspec
--dummy-path because that's where rspec will live
You can’t perform that action at this time.