Skip to content

Instantly share code, notes, and snippets.

View jeffstephens's full-sized avatar

Jeff Stephens jeffstephens

View GitHub Profile
@jeffstephens
jeffstephens / handy-docker-compose.md
Created October 22, 2019 06:05
Handy docker-compose commands

docker-compose cheat sheet

Start up services in daemon (background) mode

docker-compose up -d

Start up services in daemon (background) mode after rebuilding

@jeffstephens
jeffstephens / cob.sh
Created September 20, 2019 19:08
A handy utility to quickly switch Git branches based on a subsection of its name. e.g. `cob ast` will switch to master.
# shortcut to invoke git
g() { "$(which git)" "$@" ;}
# colors for use in normal output with `echo -e`
NORMAL_GREEN="\033[0;32m"
NORMAL_YELLOW="\033[0;33m"
NORMAL_RED="\033[0;31m"
NORMAL_CLEAR="\033[0;00m"
# checkout a branch given a unique regex pattern
// requires Chart.js
/**
* FIREBASE
*/
function initFirebase() {
var firebaseConfig = {
apiKey: "",
authDomain: "",
/**
* Speed Test
* Runs and records an internet bandwidth test. Intended to be run on an
* interval for the purpose of creating graphs.
*/
testCount = 0;
MAX_TEST_COUNT = 5;
downloadResults = [];
uploadResults = [];

Keybase proof

I hereby claim:

  • I am jeffstephens on github.
  • I am jeffstephens (https://keybase.io/jeffstephens) on keybase.
  • I have a public key ASCmHPnKQNWtiazjmGHObNyI71sBdI8pu_PBsYvljGvrOgo

To claim this, I am signing this object:

@jeffstephens
jeffstephens / title-font-for-sam.html
Last active July 21, 2016 03:42
Style overrides for Tumblr landing page
<!-- paste this code into the <head> section of your blog
the !important means it will override any other settings -->
<style type="text/css">
/* page title ("Sam Herschel Wein") */
.cover-title {
font-family: 'Dancing Script' !important;
}
/* page description ("Poet. Loudmouth. Hugger.") */
.cover-desc {
@jeffstephens
jeffstephens / snippet.js
Last active July 15, 2016 20:31
Modified "tumblr welcome page" script to hide a custom interstitial rather than redirecting to a custom page.
/**
* Tumblr Welcome Page
*
* This JS snippet should be installed in your Tumblr theme.
* Every new browser session, this will hide the custom interstitial
* if the user has already seen it once.
*/
$(document).ready( function() {
<!doctype html>
<html lang="en">
<head>
<title>Welcome to my sweet page!</title>
<link href='https://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
text-align: center;
background: #333;
color: #CCC;
<?php
class MachineDescription {
public $name, $type;
public function __construct($name, $type) {
$this->name = $name;
$this->type = $type;
}
}
@jeffstephens
jeffstephens / setURIParameter.js
Created September 10, 2015 21:14
A handy Javascript function to add/update/remove a GET parameter from a URI.
// add or update a GET variable in a URL
function setURIParameter(uri, key, value) {
if (uri.indexOf("&amp;") >= 0) {
console.log("Warning: setURIParameter expects an unencoded URI. This looks like an encoded URI (found &amp;).");
}
// just append the key-value pair to the end of the URI if this parameter isn't present
if (uri.indexOf("?" + key) === -1 && uri.indexOf("&" + key) === -1) {
// support key deletion via a recursive call (so don't add it back)
if (value.length === 0) {