Skip to content

Instantly share code, notes, and snippets.

View bronzehedwick's full-sized avatar
🐌
digging in

Chris DeLuca bronzehedwick

🐌
digging in
View GitHub Profile
@bronzehedwick
bronzehedwick / stupid.js
Last active September 19, 2016 19:38
Dumb browser detection...
/**
* Determines (poorly) the current browser.
* @returns {string} the current browser or 'unknown'.
*/
function getBrowser() {
var ua = navigator.userAgent;
var browsers = [
'Vivaldi',
'OPR', // Opera
'Firefox',
@bronzehedwick
bronzehedwick / todo.html
Created April 8, 2016 17:26
A minimal TODO app in <100 lines (pure HTML5/ES6)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TODO</title>
<style>
[data-status="done"] {
color: #999;
text-decoration: line-through;
}

Keybase proof

I hereby claim:

  • I am bronzehedwick on github.
  • I am bronzehedwick (https://keybase.io/bronzehedwick) on keybase.
  • I have a public key ASA1s4RaAOH9R4IT7fV69aYx6RTDkReBzKZJl-hXD8Kslwo

To claim this, I am signing this object:

@bronzehedwick
bronzehedwick / ordinalize.js
Created June 1, 2017 20:42
A simple function to add an ordinal to a number
function ordinalize(num) {
const lastDigit = (num + '').slice(-1);
if (lastDigit == 1) { return `${num}st`; }
else if (lastDigit == 2) { return `${num}nd`; }
else if (lastDigit == 3) { return `${num}rd`; }
return `${num}th`;
}
@bronzehedwick
bronzehedwick / bullshit-fantasy-name-generator.js
Created January 19, 2018 17:48
A dumb script that pops out an even dumber name...
function random(min, max) {
return Math.round(Math.random() * (max - min) + min);
}
let vowels = [ 'a', 'e', 'i', 'o', 'u' ];
let consonents = [ 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'z' ];
function randomName() {
const clen = consonents.length - 1;
const vlen = vowels.length - 1;
0482ad68d15afc1441d336db5b6eb1c06a8d29b5b1aed4a02173430d36ff5cf46525f4e4b3f46f8055fe678e7f47e027a9b77180bef0ab8aca6274025fa71eb737
@bronzehedwick
bronzehedwick / chat.sh
Created March 6, 2018 15:33
Simple script to start or re-attach weechat with dtach
#!/bin/sh
command -v dtach >/dev/null 2>&1 || { echo >&2 "Need dtach installed. Aborting." exit 1; }
command -v weechat >/dev/null 2>&1 || { echo >&2 "Need weechat installed. Aborting." exit 1; }
if [ -f /tmp/weechat ]; then
dtach -a /tmp/weechat
else
dtach -A /tmp/weechat weechat
fi
@bronzehedwick
bronzehedwick / post-receive
Created March 15, 2018 02:57
Git post receive hook to deploy a hugo site
#!/bin/sh
GIT_DIR=/path/to/hugo/source
WEB_DIR=/path/to/webroot
# pull the latest code.
git --git-dir "$GIT_DIR/.git" --work-tree "$GIT_DIR" pull origin master
git --git-dir "$GIT_DIR/.git" --work-tree "$GIT_DIR" checkout --force
# build the site.
hugo --source "$GIT_DIR" --destination "$WEB_DIR"
@bronzehedwick
bronzehedwick / characters.js
Created February 20, 2019 18:48
Small node script to generate a markdown file with every character mentioned in a .fountain script file
#!/usr/local/bin/node
/* eslint-env node, es6 */
const fs = require('fs');
const file = process.argv[2];
const path = require('path');
const lineReader = require('readline').createInterface({
input: fs.createReadStream(file)
});
let characters = new Map();
Verifying my Blockstack ID is secured with the address 1145uHcCDSoHNahWxJ42trCt1dfcmxH5jk https://explorer.blockstack.org/address/1145uHcCDSoHNahWxJ42trCt1dfcmxH5jk