Skip to content

Instantly share code, notes, and snippets.

View jsheridanwells's full-sized avatar

Jeremy Wells jsheridanwells

View GitHub Profile
@jsheridanwells
jsheridanwells / devise_setup.rb
Created January 17, 2018 23:39
Connecting Users to Posts :: Rspec and Capybara setup :: Devise (from Udemy Professional TDD Rails App tutorial)
# add devise gem to Gemfile.rb, go to RubyGems to get latest version #
gem 'devise'
# Build Devise
rails g devise:install
# Add correct mailer in development.rb, config method will appear in terminal output after installing
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# Generate Devise views
@jsheridanwells
jsheridanwells / redis_heroku-setup.txt
Last active December 14, 2017 15:56
Deploying ActionCable with Redis to Heroku (according to Michael Hartl)
1. install redis gem file:
gemfile.rb -> gem 'redis', '3.3.1'
2. bundle install
3. include redistogo addon:
$ heroku addons:create redistogo
(may have to set it up in heroku account dashboard???)
4. update cable.yml:
@jsheridanwells
jsheridanwells / Gemfile
Last active December 11, 2017 15:12
Rails Action Cable -API Only Setup
# add rack-cors to gem file
gem 'rack-cors'
@jsheridanwells
jsheridanwells / Setting up OmniAuth for Google Login
Last active December 5, 2017 18:20
Setting up OmniAuth for Google Login
[From this tutorial](https://medium.com/@ajayramesh/social-login-with-omniauth-and-rails-5-0-ad2bbd2a998e)
# 1. Register your app with Google, get credentials and secret
# Authorized redirect should be: http://localhost:3000/auth/google_oauth2/callback
# enable Google+ API and Contacts API
# 2. Include OmniAuth gem in gemfile:
# gem ‘omniauth-google-oauth2’
@jsheridanwells
jsheridanwells / D3-Line-Chart-Methods.js
Last active January 6, 2018 15:54
D3 methods to create a line chart using times of the day and temperature.
// 1. set dimensions of SVG relative to chart width and window height - navbar
let margin = {top: 50, right: 50, bottom: 50, left: 50},
width = $('#chart').width() - margin.left - margin.right,
height = window.innerHeight - margin.top - margin.bottom - $('#nav').height();
// 2. create SVG appended to #chart, dimensions come from values set above
let svg = d3.select('#chart').append('svg')
.attr('width', width + margin.left + margin.right)
.attr('height', height + margin.top + margin.bottom)
.append('g')