Skip to content

Instantly share code, notes, and snippets.

View hoitomt's full-sized avatar
🏠
Working from home

Michael Hoitomt hoitomt

🏠
Working from home
View GitHub Profile
@hoitomt
hoitomt / Stack
Last active September 2, 2015 18:10
Stack - [a, b, c, d]
Start:
node4 -> node3 -> node2 -> node1
Stack - no idea how many items are in it, only knows the top item
@data = node4
Next - Add a new node to the stack - "push"
push(value)
@hoitomt
hoitomt / habtm.md
Last active August 29, 2015 14:23
Create a has and belongs to many relationship in Rails 4.2

This will create a parents table, a kids table and a relationship between the two tables.

  1. Create the Parents table

    bundle exec rails generate model parents fname:string lname:string
    
  2. Create the Kids table

    bundle exec rails generate model kids fname:string lname:string
    
@hoitomt
hoitomt / mysite.nginx.conf
Last active August 29, 2015 14:15
Nginx Configuration for Web Sockets
# Allows websocket connections on /websocket
upstream mysite {
server 127.0.0.1:3000;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
var hash = window.location.hash;
var token = '0007zWwBHQBqmKj6KIDMo5HENldn9hwYpfq8EPhqkn';
var redirectUrl = 'https://reviews.local.apartmentguide.com/#' + token;
var url = 'https://primediaTest.okta.com/login/sessionCookieRedirect?token=' + token + '&redirectUrl=' + redirectUrl;
if(!hash.length) {
window.location.replace(url);
}