Skip to content

Instantly share code, notes, and snippets.

View dhigginbotham's full-sized avatar
😸
happycat

David Higginbotham dhigginbotham

😸
happycat
View GitHub Profile
const emojiContainer = document.getElementById('custom_emoji');
const emojis = emojiContainer.querySelectorAll('tr.emoji_row');
const scrapped = Array.prototype.slice.call(emojis).map((row) => {
const url = row.querySelector('span.emoji-wrapper').getAttribute('data-original');
const name = row.querySelector('[headers="custom_emoji_name"]').innerText;
return { name, url };
});
console.log('total emojis: ', scrapped.length);
console.log('data model: ', scrapped[Math.floor(Math.random() * scrapped.length)]);
const EventEmitter = require('events');
class Eventry extends EventEmitter {
constructor(type = 'none', ...args) {
super(args);
this.type = type;
}
// overload .on and .emit func to
// support special event syntax
on(ev, fn) {
// transformy is an object mapping tool to
// transform objects to another object defaults
function extenze() {
const args = Array.prototype.slice.call(arguments);
const source = args.shift();
let current;
while (current = args.shift()) {
Object.keys(current).forEach((key) => {
source[key] = typeof current[key] === 'object'
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const concat = require('gulp-concat');
// path prefix
const prefix = 'assets/';
const vendorPrefix = `${prefix}src/vendor/`;
const bowerPrefix = `${prefix}src/bower/`;
const files = {
@dhigginbotham
dhigginbotham / Easy QueryString Parameter Overrides.md
Last active January 11, 2016 04:22 — forked from justsml/Easy QueryString Parameter Overrides.md
Safer Way to Manipulate a QueryString and Return Modified URL

HOWTO: Easy QueryString Parameter Overrides

A Safer Way to Manipulate a QueryString and Return Modified URL

Demo/Example URL Transform

# Example 1 - Update current query's `tab` value
Starting URL:        https://github.com/justsml?tab=repositories
Transform W/: {tab: 'activity'}
javascript:!function(){function t(t,r){return t/r}function r(r,n){return t(r,n)*r}function n(){var n=window.prompt("Voltage?",4.2),o=window.prompt("Ohms?",.2);if(isNaN(n)&&(n=parseInt(n)),isNaN(o)&&(o=parseInt(o)),n&&o){var i="Stats:\r";i+="Amps: "+t(n,o).toFixed(2)+"\r",i+="Ohms: "+o+"\r",i+="Volts: "+n+"\r",i+="Watts: "+r(n,o).toFixed(2)+"\r",window.alert(i)}}n()}();
var request = require('request'),
util = require('util');
function handleRequest(err, data) {
if (err) throw new Error(err);
if (data.statusCode == 200 ||
data.statusCode == 304) {
var json = JSON.parse(data.body);
return json.map(translateReq);
} else {
@dhigginbotham
dhigginbotham / gist:8b88cf49c3afd5adc03f
Created December 3, 2015 03:38 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
[user]
email = [email protected]
name = John Smith
[core]
mergeoptions = --no-commit
[alias]
pff = pull --ff-only
quick = log -1 --format='%h - %an - %ad - %s' --date=local --name-status
squash = merge --squash
blog = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
var youTuber = (function(w,d,pub) {
var priv = {};
var state = {};
state.links = {};
priv.findLinksInElem = function(elem) {
var cur = {};
cur.href = elem.getAttribute('href');
cur.sessionlink = elem.getAttribute('data-sessionlink');
cur.title = elem.getAttribute('title');