Skip to content

Instantly share code, notes, and snippets.

@4rlm
4rlm / rails_essential_new_app_guide.txt
Last active September 15, 2018 21:04
Rails - Essential New App Guide
==========================
======= 1. New App =======
==========================
$ mkdir smart_cart
$ rails new smart_cart --database=postgresql
$ cd smart_cart
$ bundle update
$ bundle install
$ rails generate controller home index
> config/routes.rb, root :to => "home#index"
@4rlm
4rlm / runner_scripts.txt
Created September 13, 2018 23:36
Runner Scripts
############ Runner Scripts ############
# $ rails runner db/scripts/staffer_adr_mig.rb
# $ heroku run rails runner db/scripts/staffer_adr_mig.rb --app bds-max
############
# $ rails runner db/scripts/staffer_scrape_date_mig.rb
# $ heroku run rails runner db/scripts/staffer_scrape_date_mig.rb --app bds-max
@4rlm
4rlm / delayed_jobs.txt
Last active September 13, 2018 23:40
Delayed Jobs
############ Delayed Job ############
$ rake jobs:clear
$ heroku run rake jobs:clear --app sdf2
########################################
####### V. Delayed Jobs Schema #######
#######################################
@4rlm
4rlm / cli.txt
Created September 13, 2018 23:28
CLI - Comman Line Interface
############ command line - local ############
$ tail -f log/development.log
$ bundle exec puma
$!!! git force/pull/push if don't like changes.
$ git hist -number
$ git log -2
$ git log master -2
@4rlm
4rlm / procfile_and_foreman.txt
Last active September 13, 2018 23:33
Procfile & Foreman
############ Procfile ############
web: bundle exec rails server -p $PORT
worker: bundle exec foreman start -f Procfile.workers
worker: RAILS_MAX_THREADS=${SIDEKIQ_RAILS_MAX_THREADS:-25} bundle exec sidekiq
worker: bundle exec sidekiq -C config/sidekiq.yml
/Users/Adam/Desktop/MaxDigital/bds_max/config/sidekiq.yml
/Users/Adam/Desktop/MaxDigital/bds_max/config/puma.rb
/Users/Adam/Desktop/MaxDigital/bds_max/config/database.yml
------------------
@4rlm
4rlm / grep.txt
Created September 13, 2018 23:23
Grep
############ grep ############
$ grep -w "boo" file #=> search words only
$ egrep -w 'word1|word2' /path/to/file #=> search 2 different words
@4rlm
4rlm / rainbow.txt
Created September 13, 2018 23:22
Rainbow
############ Rainbow ############
require 'rainbow'
puts Rainbow("even bright underlined!").yellow.underline.bright
def colored(string)
indicator = Rainbow("!=>>").yellow.bright
main = Rainbow(string).yellow.underline.bright
"\n\n#{indicator} #{main}\n"
end
@4rlm
4rlm / sidekiq.txt
Created September 13, 2018 23:22
Sidekiq
############ Sidekiq ###########
$ redis-server /usr/local/etc/redis.conf #=> starts redis server
$ bundle exec sidekiq #=> starts sidekiq
Sidekiq: 500 Records updated in 20 sec
Delayed: 500 Records updated in 18 sec
Sidekiq: 4000 Records updated in 154.5 sec
Delayed: 4000 Records updated in 135.6 sec
@4rlm
4rlm / gem_install.txt
Created September 13, 2018 23:21
Gem Install
############ Gem Install ############
Link: http://bundler.io/v1.5/groups.html
$ bundle install --without test development
$ bundle install --without production
$ bundle install --with test development
$ bundle install --with production
$ bundle check
@4rlm
4rlm / ssl_certs.txt
Created September 13, 2018 23:20
SSL Certs
######### SSL CERTS #######
brew update
brew install openssl
brew tap raggi/ale
brew install openssl-osx-ca
#####
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs