Skip to content

Instantly share code, notes, and snippets.

View esparkman's full-sized avatar

Evan Sparkman esparkman

View GitHub Profile
@esparkman
esparkman / heroku-remote.md
Created April 17, 2022 16:45 — forked from randallreedjr/heroku-remote.md
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 https://git.heroku.com/staging-app.git

Cheat Sheet: Simple Authentication in Rails 5 with has_secure_password

The goal of this cheatsheet is to make it easy to add hand-rolled authentication to any rails app in a series of layers.

First the simplest/core layers, then optional layers depending on which features/functionality you want.

Specs
AUTHOR Ira Herman
LANGUAGE/STACK Ruby on Rails Version 4 or 5
@esparkman
esparkman / bootstrap-carousel.html
Created June 22, 2016 01:26 — forked from talmand/bootstrap-carousel.html
CSS changes to Bootstrap's Carousel so that the indicator dots are now thumbnails.
@esparkman
esparkman / setup-es6-linting.md
Created February 17, 2016 22:50
Linting ES6+Babel+JSX in Atom

Setup ES6+Babel+JSX Linting with Atom

This sets up Atom to properly lint ES6+Babel+JSX using Airbnb's .eslintrc as a starting point.

Steps

  1. Download Atom and get these two packages: Linter and [Linter-ESLint)(https://atom.io/packages/linter-eslint)
  2. Run npm install --save-dev eslint-config-airbnb babel-eslint eslint-plugin-react from your project root.
  3. Add "extends": "eslint-config-airbnb" to your .eslintrc
require "test/unit"
class TestFizzBuzz < Test::Unit::TestCase
def fizzbuzz(x)
"#{'Fizz' if x % 3 == 0}#{'Buzz' if x % 5 == 0}"
end
def test_equal
assert_equal fizzbuzz(3), "Fizz"
assert_equal fizzbuzz(50), "Buzz"
@esparkman
esparkman / the_install.sh
Last active October 1, 2015 05:48 — forked from therubymug/the_install.sh
Ruby development environment for OS X (Lion)
test -f /tmp/the_install.sh && rm /tmp/the_install.sh
curl -s\
https://gist.github.com/esparkman/1932717/raw/a9fd42b5d0667ac0965d413e6099527d422d2143/the_install.sh\
-o /tmp/the_install.sh
chmod 0700 /tmp/the_install.sh
. /tmp/the_install.sh
@esparkman
esparkman / .bash_profile
Created August 10, 2011 13:14 — forked from tgraham/.bash_profile
Blinged prompt
export CLICOLOR=1
# 1 2 3 4 5 6 7 8 9 0 1
export LSCOLORS=HxFxCxDxBxegedabagacad
source ~/.colors
# PS1='\n\[\e[1;32m\]\u\[\e[0m\]:\w \[\e[1;30m\]$(vcprompt)\[\e[0m\]→'
# PS1="\n\[$ERED\][\[$ECYAN\]$(hostname -s)\[$ERED\]]\[$NO_COLOR\] \[$EGREEN\]\u\[$NO_COLOR\]:\w \[$EBLACK\]\$(vcprompt)\[$NO_COLOR\]→ "
PS1="${BRIGHT_BLUE}[${BRIGHT_GREEN}$(hostname -s)${BRIGHT_BLUE}] ${BRIGHT_YELLOW}\u ${BRIGHT_RED}\$(vcprompt)${BRIGHT_WHITE}→ ${RESET}"
Started GET "/companies/3/tickets/new" for 127.0.0.1 at 2011-01-18 20:34:21 -0500
Processing by TicketsController#new as HTML
Parameters: {"company_id"=>"3"}
SQL (0.4ms) SHOW TABLES
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
Completed in 98ms
ActiveRecord::RecordNotFound (Couldn't find Company without an ID):
app/controllers/tickets_controller.rb:54:in `find_company'
~ > cat foo.rb
#!/usr/bin/env ruby
loop do
puts "whatcha wanna do"
answer = gets.chomp
case answer
when '1'