Skip to content

Instantly share code, notes, and snippets.

View connoro7's full-sized avatar

Connor Dillon connoro7

View GitHub Profile
@connoro7
connoro7 / .bash_ps1
Created October 23, 2020 07:03
PS1 upgrades, with COLORS! :)
# ${BIYellow}Usage:${Color_Off} Exactly like this! ${Green}Adding${Color_off} some ${UPurple}colors${Color_Off} to your
# command line prompts has never been easier!
# Reset
Color_Off=$'\033[0m' # Text Reset
# Regular Colors
export Black=$'\033[0;30m' # Black
export Red=$'\033[0;31m' # Red
export Green=$'\033[0;32m' # Green
@connoro7
connoro7 / .confirm
Last active October 11, 2022 18:28
"Confirm Action" Shell Function
# Usage: Command line user-error reduction and fail-safe utility
function confirm()
{
# alert the user what they are about to do.
# echo "About to $@....";
# confirm with the user
read -r -n 1 -p "$Yellow>Are you sure? [y/N]: $Color_Off" response
case "$response" in
@connoro7
connoro7 / contributing.md
Last active July 31, 2020 06:15
Github Contributing.md Markdown Template

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
  2. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
@connoro7
connoro7 / sorting.md
Created July 16, 2020 20:53
An Intro to Sorting

Introduction to Sorting


Objectives

  • Implement a bubble sort algorithm
  • Implement a selection sort algorithm
  • Implement an insertion sort algorithm

@connoro7
connoro7 / git-dev-prod-workflow.md
Created July 16, 2020 20:50
Git Dev-to-Prod Deployment Workflow

git development -> production deployment workflow

Working with 2 separate repos to store your development and production code bases.

In your development repository directory:

Add a remote for the production repository:

git remote add production git@github.com:user/production.git
@connoro7
connoro7 / callbacks-vs-promises.js
Created July 16, 2020 20:49
Callbacks vs. Promises
// GET with callbacks
function get(url, success, error) {
var ajax = new XMLHttpRequest();
ajax.onreadystatechange = function() {
if (this.readyState === 4) {
if (this.status === 200) {
var result = JSON.parse(this.responseText);
success(result);
@connoro7
connoro7 / http-server.js
Created July 16, 2020 20:48
HTTP Server
var http = require('http');
var fs = require('fs');
var url = require('url');
var path = require('path');
var app = http.createServer(function(request, response) {
var parsedURL = url.parse(request.url, true);
console.log(parsedURL);
fs.readFile(path.join('.', parsedURL.pathname), 'utf8', function(err, contents) {
if (err) {
@connoro7
connoro7 / trees.md
Created July 16, 2020 19:25
Trees Reference Sheet

Tree

A collection of nodes (starting at a root node), where each node is a data structure consisting of a value, together with a list of references to nodes (the "children"), with the constraints that no reference is duplicated (a child can only have 1 parent), and none points to the root.


Recursive Definition

@connoro7
connoro7 / arrows-vs-IIFEs.md
Created July 16, 2020 19:24
Arrow Function vs. Functional IIFEs

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';