Skip to content

Instantly share code, notes, and snippets.

View thmsmlr's full-sized avatar

Thomas Millar thmsmlr

View GitHub Profile
@thmsmlr
thmsmlr / bash-compose-up
Created July 1, 2020 05:59
A simple way to spin up many blocking bash commands at once, killing all on SIGINT
#!/usr/bin/env bash
#
# This is a basic script to launch multiple programs and kill them
# all at the same time. It does this by launching the first n-1 jobs as
# background jobs, then running the nth job as a foreground job.
#
# It traps the exist signal produced by doing `CTRL-C` on the CLI and
# iterates through the PIDs of the background jobs and runs kill -9 on them.
#
//Fucking huge hack, OMFG
setTimeout(function() {
getElementByXpath('/html/body/div[5]').remove();
}, 0);
setTimeout(function() {
nextElement = getElementByXpath('/html/body/div[5]');
if (nextElement !== null) {
getElementByXpath('/html/body/div[5]').remove();
}
}, 0);
@cobyism
cobyism / gh-pages-deploy.md
Last active July 18, 2024 05:22
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@JamieMason
JamieMason / watch.rb
Created September 26, 2012 08:16
Watch a folder for changes to files, then reload Chrome
#!/usr/bin/env ruby
require 'tempfile'
require 'fileutils'
# Signals
trap("SIGINT") { exit }
# Setup
TARGET_FOLDER = ARGV[0]
TARGET_URL = ARGV[1]