Skip to content

Instantly share code, notes, and snippets.

Avatar

Connor Dillon connoro7

View GitHub Profile
@connoro7
connoro7 / .git_aliases
Last active Oct 23, 2020
Collection of git aliases and functions
View .git_aliases
###############################################################
Please see "PS1 upgrades, with COLORS!" gist for color variables.
https://gist.github.com/connoro7/8c37fb4fb6abd6bca0c5cc13259e30c7
###############################################################
## Git
## add
alias ga='git add'
alias gaa='git add -A && git status'
## branch
@connoro7
connoro7 / .bash_ps1
Created Oct 23, 2020
PS1 upgrades, with COLORS! :)
View .bash_ps1
# ${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
Created Oct 23, 2020
"Confirm Action" Shell Function
View .confirm
# 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
[yY][eE][sS]|[yY])
@connoro7
connoro7 / contributing.md
Last active Jul 31, 2020
Github Contributing.md Markdown Template
View contributing.md

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 Jul 16, 2020
An Intro to Sorting
View sorting.md

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 Jul 16, 2020
Git Dev-to-Prod Deployment Workflow
View git-dev-prod-workflow.md

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
View callbacks-vs-promises.js
// 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);
View http-server.js
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 Jul 16, 2020
Trees Reference Sheet
View trees.md

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