Skip to content

Instantly share code, notes, and snippets.

Avatar

Connor Dillon connoro7

View GitHub Profile
@connoro7
connoro7 / arrows-vs-IIFEs.md
Created Jul 16, 2020
Arrow Function vs. Functional IIFEs
View arrows-vs-IIFEs.md

Arrows Functions vs. Function IIFEs

When creating an IIFE, use a regular function, NOT an arrow function.

With a fat arrow, this is bound to the this of the surrounding code (in this case Window or Global).

(() => {
  'use strict';
@connoro7
connoro7 / async-await-info.md
Created Jul 16, 2020
Async & Await Reference Sheet
View async-await-info.md

async & await

Callbacks

request('http://www.omdbapi.com/?s=star%20wars', (error, response, body) => {
  const results = JSON.parse(body);
  console.log(results);
});
@connoro7
connoro7 / heroku-quick-ref.md
Created Jul 16, 2020
Heroku Quick Reference Sheet
View heroku-quick-ref.md

Heroku Quick Reference

heroku login # login once
heroku create [name] # Initializes heroku app and adds remote.
heroku addons:create heroku-postgresql # add a postgres db addon to your heroku app
heroku logs [--tail] # Shows heroku server terminal
heroku pg:psql # connect to heroku addon database server
heroku config # shows heroku environment variables
  - heroku config:set clown=fiesta # set a config variable
View express-starter.js
const express = require('express');
const morgan = require('morgan');
const cors = require('cors');
const app = express();
app.use(morgan('dev'));
app.use(cors());
app.get('/', (req, res) => {
View keybase.md

Keybase proof

I hereby claim:

  • I am connoro7 on github.
  • I am dillpickles (https://keybase.io/dillpickles) on keybase.
  • I have a public key ASBU-ywQR77Pny0QblUqQNXwqsHeiBH5WE7mWj2r3dH24Qo

To claim this, I am signing this object:

@connoro7
connoro7 / exa Enhanced v1
Created Jun 4, 2020
Exa alias options + documentation
View exa Enhanced v1
##
# Author: Connor Dillon
# Created: June 4 2020
# Some useful `exa` aliases meant to replace standard `ls` usage.
# The aliases use `l` instead of `exa` to make use of muscle memory from typing `ls` all the time :)
# Use `$ exahelp` to print documentation to console
#
# Download `exa` via:
# OSX: $ brew install exa
# Linux: $ sudo apt-get install exa
@connoro7
connoro7 / exportSSH.sh
Last active May 24, 2020
Bash script to export all SSH keys (public and private) to external folder for backup on a cold storage drive.
View exportSSH.sh
#!/bin/bash
# Edit EXPORT_FOLDER to change the export location
EXPORT_FOLDER=~/ssh_export
# Append (or remove) any additional key locations you may have to the KEYS array.
KEYS=(~/.gnupg ~/.pki/nssdb ~/.gnome2/keyrings ~/.ssh /usr/local/apache2/conf/ssl.crt/server.crt /usr/local/apache2/conf/ssl.key/server.key /etc/ssh /etc/ssl/private /etc/cups/ssl)
#
echo -e "SSH Keys being sent to: \033[44;97m$EXPORT_FOLDER\033[0m"
for FILE in "${KEYS[@]}"
do
# for use with OSX
@connoro7
connoro7 / .vimrc
Created May 6, 2020
.vimrc Settings
View .vimrc
set number
set ruler
filetype indent on
set ai
set mouse=a
set incsearch
set hlsearch
set paste
set confirm
set ignorecase