Skip to content

Instantly share code, notes, and snippets.

View ironbyte's full-sized avatar

ironbyte ironbyte

View GitHub Profile
@ironbyte
ironbyte / Dockerfile
Created March 1, 2019 05:20
Dockerfile for deploying a React app (created via CRA) in production
# Stage 1 - build environment
FROM node:8.15-alpine as builder
WORKDIR /usr/src/app/
COPY . ./
RUN npm install --production
RUN npm run build
# Stage 2- production environment
FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /usr/src/app/build/ /usr/share/nginx/html/

Node.js Express JSON API - CRUD Stickers We'll be using:

Postgres for our database

knex.js for our database migrations, seeds and queries.

express.js for our JSON routes

Mocha, Chai and SuperTest to test our routes

@ironbyte
ironbyte / Knex-Setup.md
Created February 24, 2019 09:52 — forked from NigelEarle/Knex-Setup.md
Setup Knex with Node.js

Knex Setup Guide

Create your project directory

Create and initialize your a directory for your Express application.

$ mkdir node-knex-demo
$ cd node-knex-demo
$ npm init
@ironbyte
ironbyte / gist:2487cb5ff9c3f9d96b224c3f315a7db2
Created January 31, 2019 21:16 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@ironbyte
ironbyte / Postman.desktop
Created November 18, 2018 16:10 — forked from aviskase/Postman.desktop
Install Postman
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/home/USERNAME/Postman/app/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
@ironbyte
ironbyte / index.js
Created October 5, 2018 11:43 — forked from JonathanMH/index.js
JSON Web Token Tutorial: Express
// file: index.js
var _ = require("lodash");
var express = require("express");
var bodyParser = require("body-parser");
var jwt = require('jsonwebtoken');
var passport = require("passport");
var passportJWT = require("passport-jwt");
@ironbyte
ironbyte / deploy-create-react-app-with-nginx.md
Created August 31, 2018 06:11 — forked from huangzhuolin/deploy-create-react-app-with-nginx.md
[Deploy create-react-app(react-router) with nginx] #react #nginx

Create-react-app

Create React apps with no build configuration.

Thanks to create-react-app. It's saves a lot of my time. I remember several months ago I had to setup a lot just for a react app, webpack, babel, test environment and so on... Fortunately, everything becomes easy now. Though you have many choices of start boiler plate, you worth trying this.

React router

If you are build a SPA with react, you probably use react-router.

@ironbyte
ironbyte / postman_install.sh
Created August 9, 2018 18:35 — forked from posemon/postman_install.sh
Postman install Ubuntu 18.04
#!/bin/bash
# Get postman app
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/bin/postman
#Create a Desktop Entry
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
@ironbyte
ironbyte / str_incrementer.rb
Created March 27, 2018 04:57
String incrementer
def increment_string(input)
#your code here
s = input
s_digits = input.slice!(/\d+/)
s_digits_length = s_digits.length
end
def gcd(n, m)
if (n > m) && (n * m > 0)
r = n % m
if r == 0
return m
else
return gcd(m, r)
end
end