Skip to content

Instantly share code, notes, and snippets.

View thomaswilburn's full-sized avatar
🦝

Thomas Wilburn thomaswilburn

🦝
View GitHub Profile
@thomaswilburn
thomaswilburn / index.html
Created July 19, 2015 16:08
Weekly JS Challenge #2
<!doctype html>
<html>
<head>
<meta charset="utf8">
<title>Making progress...</title>
<style>
body {
width: 600px;
margin: auto;
max-width: 100%;
@thomaswilburn
thomaswilburn / evercookie.js
Created August 3, 2015 16:47
Evercookie implementation
/*
A minimal evercookie implementation for window.name, cookies, localstorage, and IDB.
Each get/set function takes a key/value pair as arguments. It also has a clear() method
that will reset storage, which is useful during testing.
*/
// This module uses ES6 promises, which are shimmed in other browsers
var Promise = require("es6-promise").Promise;
/*
@thomaswilburn
thomaswilburn / keybase.md
Created October 19, 2015 22:28
Keybase verification

Keybase proof

I hereby claim:

  • I am thomaswilburn on github.
  • I am thomaswilburn (https://keybase.io/thomaswilburn) on keybase.
  • I have a public key whose fingerprint is FD1F EAF5 B393 F445 FBE8 D8B7 FAAE B714 8B00 EDC2

To claim this, I am signing this object:

@thomaswilburn
thomaswilburn / Vagrantfile
Last active October 22, 2015 01:57
Very simple WordPress Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# This sets the VM that we want to use - in this case, a classic Ubuntu 12.01 box
config.vm.box = "hashicorp/precise32"
# This makes the VM available in your browser on port 8080, and on MySQL's default port
config.vm.network "forwarded_port", guest: 80, host: 8080 #HTTP
config.vm.network "forwarded_port", guest: 3306, host: 3306 #MySQL
//taking a crack at it
//totally untested, probably doesn't work
var BatChannel = function(endpoint, interval) {
this.endpoint = endpoint;
this.pending = [];
this.interval = interval || 30000;
this.tick();
};
BatChannel.prototype = {
[...]
var loadEmmet = true;
//one-time startup
var init = function() {
aceConfig.themes.forEach(function(theme) {
var option = document.createElement("option");
option.innerHTML = theme.label;
option.setAttribute("value", theme.name);
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# This sets the VM that we want to use - in this case, a classic Ubuntu 12.01 box
config.vm.box = "hashicorp/precise32"
# This makes the VM available in your browser on port 8080, and on MySQL's default port
config.vm.network "forwarded_port", guest: 80, host: 1234 #HTTP
#config.vm.network "forwarded_port", guest: 3306, host: 3306 #MySQL
@thomaswilburn
thomaswilburn / scroll-class.js
Created February 10, 2016 20:56
Scroll-triggered effects without jQuery
/*
This causes any elements with scroll-class attributes to add be updated either when they
reach the halfway point of the window, or when a target element (matching the selector in
the scroll-trigger attribute) reaches that point. For example:
<div class="example" scroll-class="activated" scroll-trigger=".trigger">
This element will gain the "activated" class when the following element scrolls halfway:
<span class="trigger">TRIGGER ELEMENT</span>
</div>
@thomaswilburn
thomaswilburn / demo.js
Last active April 27, 2016 23:30
A template literal tag that lets you write verbose regex syntax
var r = require("./verboseRegex.js");
var regex = r`
^ # from the start of the string
\s* # with any number of spaces
\(\s+ # find the first paren, followed by whitespace
([^)]+) # capture anything that's not a closing paren
\s*\) # followed by whitespace and a closing paren
`;
@thomaswilburn
thomaswilburn / snippet.js
Last active August 23, 2016 16:38
document-register-element v1 shim test
var F = function(self) {
//being called from the shim
if (self) {
HTMLElement.call(self);
return self;
}
//must be native, use Reflect.construct() to perform super()
//this code is untested, came from rniwa
return Reflect.construct(HTMLElement, [], F);
};