Skip to content

Instantly share code, notes, and snippets.

View davydog187's full-sized avatar
🍍
Still Elixirin'

Dave Lucia davydog187

🍍
Still Elixirin'
View GitHub Profile
var five = require("johnny-five");
var board = new five.Board();
function outputBinary(number, leds) {
var states = [
number & 1,
number & 2,
number & 4
];
@davydog187
davydog187 / gist:dc5b228991c306261d21
Created April 4, 2015 14:06
Process url for cip6791
var exampleInputs = [
"http://example.com/",
"http://example.com/#hash",
"http://example.com/#hash?something=hello",
"http://example.com/#hash?something=hello&else=hi"
];
function getHashValueFrom(url, hashIndex, queryStringIndex) {
if (hashIndex === -1) {
return "";
# -*- mode: sh -*-
# ~/.bash_prompt: executed by bashrc for interactive shells.
DULL=0
BRIGHT=1
_bold=$(tput bold)
_normal=$(tput sgr0)
FG_BLACK=30
@davydog187
davydog187 / responsive_background_images.html
Created April 28, 2015 18:54
Responsvie background images
<!DOCTYPE html>
<html>
<head>
<style>
.small div {
width:200px;
height:75px;
}
@davydog187
davydog187 / gpt-leak.html
Created May 13, 2015 19:32
GPT Related Memory Leak
<html>
<head>
<title>GPT Test Page</title>
</head>
<body>
<div id="01dff7272bfc464224240bc6f1f8d25b"></div>
<button id="refresh">Clear and Refresh</button>
<span>Times refreshed: </span><span id="times">0</span>
function makeBootstrappingLoader(scriptBody, clientAppUrl, isAsync) {
var loadAsync = isAsync ? "s.async = true;\n" : "";
return "<script type=\"text/javascript\">\n" +
"var s = document.createElement(\"script\");\n" +
"s.setAttribute(\"src\", \"" + clientAppUrl + "\");\n" +
"document.body.insertBefore(s, null)\n"+
loadAsync +
"function loaded(e) {\n" +
scriptBody + "\n" +
"s.removeEventListener(\"load\", loaded, false);\n" +
@davydog187
davydog187 / prototype.js
Created October 21, 2015 17:35
explain how prototype works
function test() {}
test.prototype.number = 5;
var a = new test
var b = new test
b.number // 5
b.hasOwnProperty("number") // false <- false because number is on the prototype
b.number = 10 // now were assigning to number, putting it on the instance
@davydog187
davydog187 / gist:facf3181d8ff5e9371f931b42ca4bc86
Last active September 22, 2016 14:41
digiday remove filter bookmartlet
javascript:(function() {const ads = Array.from(document.querySelectorAll(".ad-wrapper")).forEach(ad => ad.parentNode.removeChild(ad));const blur = Array.from(document.querySelectorAll(".entry-content")).forEach(thing => thing.style.webkitFilter = "none");})();
@davydog187
davydog187 / .vimrc
Created January 20, 2018 22:55
Stripped down vimrc for ubuntu
" .vimrc
" !silent is used to suppress error messages if the config line
" references plugins/colorschemes that might be missing
" Disable Vi compatibility
set nocompatible
if has("autocmd")
" Load files for specific filetypes
@davydog187
davydog187 / .bashrc
Created January 20, 2018 22:55
Edited bashrc for ubuntu
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac