Skip to content

Instantly share code, notes, and snippets.

View main.ts
import { parse } from "";
function greet(name?: string): void {
if (!name) {
console.log('Hello, World!');
} else {
console.log(`Hello, ${name}!`);
thgaskell / merged.geojson
Created Mar 20, 2020
List of Grab-and-Go Meal School Sites
View merged.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am thgaskell on github.
  • I am thgaskell ( on keybase.
  • I have a public key ASAxNZp0H4yBT01iTtYYwRSBVqYADK8D-ciTgo_CyVDwowo

To claim this, I am signing this object:

View vendingModule.js
module.exports = {
create: function () {
var display = [
{ name: "chips", price: 0.75, quantity: 5 },
{ name: "soda", price: 1.50, quantity: 0 },
{ name: "candy", price: 1.00, quantity: 5 }
var vendingMachine = {
"restock": function (itemIndex) {
thgaskell /
Last active Nov 7, 2019
Basic Authentication with Passport

Basic Authentication with Passport

Basic authentication is one of the simplest authentication strategies because it doesn't require cookies, sessions, or even a login form! Instead, it uses HTTP headers which means credentials are transmitted on each request.


You will need to install passport and passport-http. The passport-http module is what allows you set up the Basic Authentication Scheme, in addition to a couple other authentication strategies.

$ npm install express passport passport-http --save
thgaskell /
Created Jul 9, 2015
Pixel Painter Schemas

Pixel Painter Schema + Migrations

Using your existing Pixel Painter project, we're going to upgrade it to use Express (if it isn't already).

In addition, intialize the project with sequelize, to create the folders: config, migrations, and models.

Now that we know a little bit about creating migrations, let's use Sequelize to create a couple migration files.

  1. Using sequelize model:create to create model and migration files for a Drawing table.
  2. The only requirement for the Drawing table is that it must have a data column, with the data type json.
thgaskell / gist:5987fccbd8473b5ef78f
Last active Sep 21, 2018
Introduction to Sequelize Migrations
View gist:5987fccbd8473b5ef78f

What are Migrations

Just like how we use Git to version control source code, we use migrations to manage the state of our database schemas.

I'm not really sure what that means...

Imagine you're working on project with another developer, and you're both tasked with creating a specific part of an event planning application. Let's say you are in charge of creating the Users and your friend is going to create the Events.

Let's say you and your friend divided the work in a way so that neither of you will have to to use each other's code to finish your tasks. While you're working on your part of the application, you only really need to touch the Users table when you are working with the database.

Before you begin

Make sure that the project you are in is a node project (it has a package.json) and you have already installed and initialized sequelize (npm install --save sequelize, sequelize init). Also make sure that your config.json file has the correct credentials to connect to your database.

thgaskell /
Last active Jan 18, 2022
Sequelize + Express Starter Guide
thgaskell / ES5-Number.js
Created May 4, 2015
Private variables with TypeScript + WeakMaps
View ES5-Number.js
var Number;
(function (Number_1) {
var map = new WeakMap();
var internal = function (object) {
if (!map.has(object))
map.set(object, {});
return map.get(object);
var Number = (function () {
function Number(x) {
thgaskell /
Created Feb 22, 2015
Sequelize Associations

File Structure:

  • seed_database.js
  • config.json
  • models/
    • index.js
    • User.js
    • UserType.js

Make sure that the SQL configs are in config.json.