Skip to content

Instantly share code, notes, and snippets.

View jmshal's full-sized avatar

Jacob Marshall jmshal

View GitHub Profile
docker-machine create -d virtualbox swarm-manager
manager_ip=$(docker-machine ip swarm-manager)
manager_config=$(docker-machine config swarm-manager)
docker-machine create -d virtualbox swarm-agent-1
agent1_ip=$(docker-machine ip swarm-agent-1)
agent1_config=$(docker-machine config swarm-agent-1)
docker-machine create -d virtualbox swarm-agent-2
agent2_ip=$(docker-machine ip swarm-agent-2)
@jmshal
jmshal / swarm-with-docker-machine.sh
Created February 11, 2016 22:21 — forked from nishanttotla/swarm-with-docker-machine.sh
A bash script to set up a simple Docker Swarm cluster using Docker Machine
################################## INSTRUCTIONS ##################################
# 1. Make sure docker-machine is installed on your machine #
# 2. Download the file #
# 3. Run using $ . swarm-with-docker-machine.sh so that DOCKER_HOST is exported #
##################################################################################
# Clean any existing machines
yes | docker-machine rm manager
yes | docker-machine rm agent1
yes | docker-machine rm agent2
@jmshal
jmshal / iterm2-solarized.md
Created May 7, 2016 03:05 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + oh my zsh + solarized + Meslo powerline font (OSX)

Solarized

{
"1": "Bulbasaur",
"2": "Ivysaur",
"3": "Venusaur",
"4": "Charmander",
"5": "Charmeleon",
"6": "Charizard",
"7": "Squirtle",
"8": "Wartortle",
"9": "Blastoise",
/**
* JS scoping, and this property resolutions rules in ES7/ES8.
*
* Quiz: x is gone, and x is everywhere!
*
* Help find Xs! What's the output?
*/
let x = 1;
@jmshal
jmshal / index.js
Last active April 27, 2024 04:15
npm i --save gist:9ccd7fce7eefb63cd118a217636e31a6
'use strict';
/**
* Resize an image (from URL). Ensures that the images is contained within the bounding box.
*
* @param {string} url The image URL
* @param {number} width The maximum image width
* @param {number} height The maximum image height
* @param {boolean} [padding] Whether to include padding if the image doesn't fit perfectly
* @returns {Promise<string>}
@jmshal
jmshal / index.js
Created October 6, 2016 09:54
npm i --save gist:53c856c340000421fd7d9fc794b23086
'use strict';
const TEST_OVERFLOW = /(auto|scroll)/;
/**
* Scrolls to an element by scrolling it's parent scroll container.
*
* @param {Element} element The element to scroll to
* @param {boolean} [center] Whether to center the element within it's scroll container
*/
@jmshal
jmshal / atob.js
Last active April 27, 2024 04:12
Node.js ponyfill for atob and btoa encoding functions
module.exports = function atob(a) {
return new Buffer(a, 'base64').toString('binary');
};
@jmshal
jmshal / README.md
Last active May 15, 2018 01:54
Electron `position: sticky` shim

electron-sticky-shim

This 8 line shim makes elements with position: sticky work as intended in situations where you have scrollable content nested within your app - see this for an example.

Installation

You can either copy the sticky-shim.js file from this gist, or install it as a module using npm...

$ npm install --save gist:4c7dd81a61adcb648944a16b0fac717f
@jmshal
jmshal / AWS Swarm cluster.md
Created January 14, 2017 19:52 — forked from ghoranyi/AWS Swarm cluster.md
Create a Docker 1.12 Swarm cluster on AWS

This gist will drive you through creating a Docker 1.12 Swarm cluster (with Swarm mode) on AWS infrastructure.

Prerequisites

You need a few things already prepared in order to get started. You need at least Docker 1.12 set up. I was using the stable version of Docker for mac for preparing this guide.

$ docker --version
Docker version 1.12.0, build 8eab29e

You also need Docker machine installed.