Skip to content

Instantly share code, notes, and snippets.

View codingChewie's full-sized avatar
💭
(╯'□')╯︵ ┻━┻

Chewie codingChewie

💭
(╯'□')╯︵ ┻━┻
View GitHub Profile
# Terminal Cheat Sheet
pwd # print working directory
ls # list files in directory
cd # change directory
~ # home directory
.. # up one directory
- # previous working directory
help # get help
-h # get help
@codingChewie
codingChewie / ultimate-ut-cheat-sheet.md
Created February 11, 2021 00:13 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@codingChewie
codingChewie / gitHub-curl.sh
Created December 1, 2020 17:06 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@codingChewie
codingChewie / unzip-pub.sh
Created November 19, 2020 14:46
Bash shell script to unzip an ePub
#!/bin/bash
# date: 20-11-03
# dev: codingChewie
# purpose: Unzip an ePub with name passed in Terminal
# version: 1.1
# name: unzip-pub.sh
EXT=".epub"
LOC=""
@codingChewie
codingChewie / css-validate.sh
Created November 17, 2020 20:42
Validation setup for CSS files on Mac
# !/bin/bash
## date: 20-11-05
## dev: codingChewie
## purpose: validates CSS files
## version: 1.0
## name: cssvalidate.sh
CSS_DIR="" ## Directory where CSS files will be placed to be tested
CSS_JAR="" ## Location for JAR files
@codingChewie
codingChewie / index.js
Created November 9, 2019 20:38 — forked from jwo/index.js
Simple way to sign in with github for oAuth in Node/Express
const express = require("express")
const app = express()
var passport = require("passport")
var session = require("express-session")
var GitHubStrategy = require("passport-github2").Strategy
const GITHUB_CLIENT_ID = "your-client-id-here" // or get from process.env.GITHUB_CLIENT_ID
const GITHUB_CLIENT_SECRET = "your-client-secret-here" // or get from process.env.GITHUB_CLIENT_SECRET
const GITHUB_CALLBACK_URL = "http://localhost:5000/auth/github/callback" // or get from process.env.GITHUB_CALLBACK_URL
@codingChewie
codingChewie / node_nginx_ssl.md
Created November 1, 2019 13:55 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean 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

@codingChewie
codingChewie / shopsy.md
Created September 22, 2019 22:36
This gist is to help setup the app shopsy

After reading the Q&A I didn't see my issues resolved with the provided source files of the shopsy app so hope this helps the next person resolve the package.json issues I'm experiencing.

The video instructed to run an npm i but I received a few fatal errors and this is because of the "bcrypt": "^1.0.3" being deprecated. I did find a Q&A that mentions bcrypt-nodejs but when I reference this on NPM it indicates it's deprecated. Instead I removed the line "bcrypt": "^1.0.3" and replaced it with npm i bcryptjs.

When I ran npm start I received an error of bcrypt and that is because there is a require in a file that needs to be changed:

/server/models/mongoose/User.js
@codingChewie
codingChewie / app.js
Created September 19, 2019 04:06 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@codingChewie
codingChewie / express_in_electron.md
Created September 9, 2019 23:55 — forked from maximilian-lindsey/express_in_electron.md
How to run Express inside an Electron app

How to run Express inside an Electron app

You can run your Express app very easily inside your Electron app.

All you need to do is to:

  • place all the files of your Express app inside a new app folder in your_electron_app\resources\app
  • reconfigure the app.js file
  • refactor some relative pathes in your Express app