Skip to content

Instantly share code, notes, and snippets.

View jsheridanwells's full-sized avatar

Jeremy Wells jsheridanwells

View GitHub Profile
@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')
@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 / 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 / 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 / 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

RSpec TDD Tutorial

From this tutorial

  1. Set up new Rails app. -T flag skips installation of MiniTest:
$ rails new my_app -T
  1. Add RSpec to Gemfile.rb:
@jsheridanwells
jsheridanwells / notes_part1.md
Last active June 26, 2024 13:13
Rails ToDo API w/ RSpec TDD

Build a RESTful JSON API w/ Rails and RSpec PART ONE

From this tutorial.

Dependency Setup

Gemfile.rb:

  1. Rspec-rails to development and test groups
group :development, :test do
  gem 'rspec-rails', '~> 3.5'
@jsheridanwells
jsheridanwells / Notes1.md
Created February 1, 2018 21:19
Testing an AngularJS app with Karma and Jasmine

From this tutorial

Setup

Install basic structure

$ mkdir meet-irl && cd meet-irl
$ touch server.js
$ mkdir app && cd app
$ touch index.html app.js app.css
@jsheridanwells
jsheridanwells / notes.md
Created February 9, 2018 14:09
Setting up SSL certificates on NGINX server w/ Certbot

Setting UP SSL Certificates on NGINX Server on Ubuntu w/ Certbot

Certbot Docs: https://certbot.eff.org/docs/

Digital Ocean Tutorial: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04

  1. Install Certbot:
$ sudo add-apt-repository ppa:certbot/certbot
@jsheridanwells
jsheridanwells / Section_2-1.md
Last active February 12, 2018 19:19
Udemy Angular 2 / .NET Core course

Angular Setup

  1. New project (make sure Node version is set to 8.9.1 (or most current):
$ ng new ProjectName
  1. To create a component: ng g c componentName.

  2. Import http modules in app.module.ts: