Skip to content

Instantly share code, notes, and snippets.

View DrPep's full-sized avatar

Nigel Pepper DrPep

View GitHub Profile
@DrPep
DrPep / Error-Handling-Patterns-Express.md
Created February 20, 2019 23:48 — forked from zcaceres/Error-Handling-Patterns-Express.md
error handling patterns in Express

Handling Errors

Express.js makes it a breeze to handle errors in your routes.

Express lets you centralizes your error-handling through middleware.

Let's look at patterns for how to get the most out of your error-handling.

First, our error-handling middleware looks like this:

@DrPep
DrPep / docker-cheat-sheat.md
Created August 30, 2018 19:07 — forked from dwilkie/docker-cheat-sheat.md
Docker Cheat Sheet

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

@DrPep
DrPep / Knex-Setup.md
Created May 4, 2018 00:12 — 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
@DrPep
DrPep / README.md
Last active May 3, 2018 21:55
Node with ES6 - sad that this is even necessary

Example Node Server w/ Babel

Getting Started

First we'll install babel-cli.

$ npm install --save-dev babel-cli
@DrPep
DrPep / web-servers.md
Created May 2, 2018 04:10 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
@DrPep
DrPep / ultimate-ut-cheat-sheet.md
Created February 5, 2018 19:11 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@DrPep
DrPep / galera_cluster.yml
Created October 28, 2017 03:42 — forked from lucidfrontier45/galera_cluster.yml
docker-compose file for mariadb galera cluster
node1:
image: hauptmedia/mariadb:10.1
hostname: node1
ports:
- 13306:3306
environment:
- MYSQL_ROOT_PASSWORD=test
- REPLICATION_PASSWORD=test
- MYSQL_DATABASE=maria
- MYSQL_USER=maria

Keybase proof

I hereby claim:

  • I am drpep on github.
  • I am drpep (https://keybase.io/drpep) on keybase.
  • I have a public key ASDCjdz-oiNPl_BWrdrPUBqcUizvJgAjn19R-kdpd3pLoAo

To claim this, I am signing this object: