Skip to content

Instantly share code, notes, and snippets.

What do we do?

  • Outcomes and standards-based education
  • Not a curriculum company

Who is this for?

  • Turning juniors/mids into mids/seniors
  • Turning seniors into leads, principles, VPs
  • Not necessarily with career alignment- they don't have to go all-in
@kimschles
kimschles / deploy-server-to-heroku.md
Last active April 26, 2018 17:55
How to deploy an node, express and postgres backend to heroku
  1. Create a new heroku remote
  • heroku create
  1. Push your code to heroku
  • git push heroku master
  1. Add the heroku postgres addon
  • heroku addons:create heroku-postgresql:hobby-dev
  1. Open your heroku app from the command line
  • heroku open
  1. Run knex migrations
  • heroku run knex migrate:latest

How to setup a postgres db with knex

  1. Create a db on my computer
  • createdb <name_of_database>
  1. Create tables in the db using the migration files
  • knex migrate:latest
  1. Add data to the database and tables
  • knex seed:run
const environment = process.env.NODE_ENV || 'development';
const config = require('./knexfile');
const environmentConfig = config[environment];
const knex = require('knex');
const connection = knex(environmentConfig);
module.exports = connection;
@kimschles
kimschles / node-multiple-calls-render.js
Created March 27, 2018 02:31 — forked from magalhini/node-multiple-calls-render.js
Example on how to render multiple responses into a route in node.js
const express = require('express')
const app = express()
const path = require('path')
const fetch = require('node-fetch')
const PORT = process.env.PORT || 3000
app.get('/api/user', (req, res) => {
res.json({ name: 'Richard' });
});
//general:
COPY table_name TO 'location/here.csv' DELIMITER ',' CSV HEADER;
//specific:
COPY products_273 TO '/tmp/products_199.csv' DELIMITER ',' CSV HEADER;
// Thank you, Dan Levy
function domReady(f, o, m) {
(o = document), (m = 'addEventListener');
o[m] ? o[m]('DOMContentLoaded', f) : ((o = window), o.attachEvent('onload', f));
}
// example usage:
domReady(function() {
fetch(url)
.then(response => response.json())
.then()
.catch(console.error)

How to Preview a Mailer

Ruby on Rails's Action Mailer allows you to preview an email view. It's a bit tricky, but if you'd like to see an email before it is sent to a user, follow the instructions below.

Step 1: Set Up Your Development Environment

Step 2: Determine Which Email You'd Like to Preview