Skip to content

Instantly share code, notes, and snippets.

View connoro7's full-sized avatar

Connor Dillon connoro7

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / .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 / .git_aliases
Last active October 23, 2020 07:13
Collection of git aliases and functions
###############################################################
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 / .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 / full-width-bleed-index.html
Created October 11, 2022 19:04
CSS full-width bleed background for section within container
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="full-width-bleed-style.css" />
</head>
<body>
@connoro7
connoro7 / base-10 rem.css
Created October 11, 2022 19:15
Safely converts rem units from base-16 to base-10
/* Converts rem units from base-16 to base 10. */
/* No more 76.5px / 16 = 4.78rem, or 25px / 16 = 1.56rem, or 2.2rem * 16 = 35.2px */
/* 2.5rem becomes 25px */
/* 7.65rem becomes 76.5px */
:root {
/* Adjusts rem to base-10 equivalent */
font-size: 62.5%;
}