Skip to content

Instantly share code, notes, and snippets.

View tolumide-ng's full-sized avatar

Tolumide Shopein tolumide-ng

  • Ex-Andela
  • Berlin, Germany
  • 03:07 (UTC -12:00)
View GitHub Profile
@tolumide-ng
tolumide-ng / index.js
Created August 20, 2019 18:14
Testing Formik with Jest and Enzyme
import './index.css';
import React from 'react';
import { connect } from 'react-redux';
import { css } from '@emotion/core';
import SyncLoader from 'react-spinners/SyncLoader';
import { Formik, Form, Field } from 'formik';
import { authAction } from '../../store/modules/auth/actions';
import logo from '../../assets/images/logo.png';
import SignupSchema from './schema';
@tolumide-ng
tolumide-ng / Drop enum_column in sequelize
Created August 28, 2019 12:39
How to Drop an enum column and replace with a new datatype in sequelize ORM
module.exports = {
up: (queryInterface, Sequelize) => {
return Promise.all([
(queryInterface.removeColumn('Ratings', 'ratings'),
queryInterface.sequelize.query('DROP TYPE "enum_Ratings_ratings";'),
queryInterface.addColumn('Ratings', 'ratings', {
type: Sequelize.INTEGER,
validate: {
isInt: true,
isIn: [[1, 2, 3, 4, 5]],
class Employee:
num_of_emps = 0
raise_amt = 1.04
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.email = first + '.' + last + '@example.com'
self.pay = pay
@tolumide-ng
tolumide-ng / node_nginx_ssl.md
Created September 23, 2019 14:27 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to Digital Ocean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@tolumide-ng
tolumide-ng / README.md
Created October 23, 2019 09:49 — forked from greyscaled/README.md
Sequelize + Express + Migrations + Seed Starter
@tolumide-ng
tolumide-ng / nigeria-state-and-lgas.json
Created December 29, 2019 17:11 — forked from PaulOnyekwelu/nigeria-state-and-lgas.json
Nigeria States and LGAs in one JSON file
[
{
"state": "Adamawa",
"alias": "adamawa",
"lgas": [
"Demsa",
"Fufure",
"Ganye",
"Gayuk",
"Gombi",
@tolumide-ng
tolumide-ng / Docker shell commands.sh
Created December 30, 2019 12:39 — forked from tomysmile/Docker shell commands.sh
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
@tolumide-ng
tolumide-ng / jwt-expiration.md
Created January 2, 2020 10:07 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@tolumide-ng
tolumide-ng / postgresql_mac.md
Created January 16, 2020 13:15
Postgresql on Mac

Installing

Reference

brew update
brew install postgresql
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
@tolumide-ng
tolumide-ng / graphql twitter bearer token
Created January 25, 2020 17:48
getting bearer token from twitter oauth2.0
import { ResolverMap } from "../../types/graphql-utils";
import axios from "axios";
import dotenv from "dotenv";
const qs = require("qs");
dotenv.config();
export const resolvers: ResolverMap = {
Query: {
twitterLogin: async (_: any): Promise<any> => {
let bearerToken: string = "";