Skip to content

Instantly share code, notes, and snippets.

View thomaswilburn's full-sized avatar
🦝

Thomas Wilburn thomaswilburn

🦝
View GitHub Profile
@thomaswilburn
thomaswilburn / unpinner.vbs
Created January 29, 2020 16:50
Unpin taskbar icons
Set ShellApp = CreateObject("Shell.Application")
Set FSO = CreateObject("Scripting.FileSystemObject")
homeFolder = ShellApp.NameSpace(&H28).Self.Path
PinnedPath = homeFolder & "\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
Set PinnedNS = ShellApp.NameSpace(PinnedPath)
Set PinnedFolder = FSO.GetFolder(PinnedPath)
Set PinnedFiles = PinnedFolder.Files
@thomaswilburn
thomaswilburn / loadDocs.js
Created December 12, 2019 20:56
annotatedDocs.js
var { google } = require("googleapis");
var async = require("async");
var os = require("os");
var path = require("path");
var { authenticate } = require("./googleauth");
module.exports = function(grunt) {
grunt.registerTask("docs", "Load Google Docs into the data folder", function() {
@thomaswilburn
thomaswilburn / index.js
Created October 25, 2019 20:30
source-un-map
var http = require("http");
var https = require("https");
var { SourceMapConsumer } = require("source-map");
var fs = require("fs").promises;
var path = require("path");
var fetch = function(address) {
return new Promise(function(ok, fail) {
var parsed = new URL(address);
var remote = parsed.protocol == "http:" ? http : https;
var request = require("request");
var dateFormat = require("dateformat");
var today = new Date();
/* Format the date to be todays date in mm-dd-yyy format for later use */
today = dateFormat(today, "mm-dd-yyyy");
onCallDateFormat = dateFormat(today, "yyyy-mm-dd");
var jiraUrl = "";
@thomaswilburn
thomaswilburn / index.html
Created July 7, 2019 19:23
Demo of making a D3 chart
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello!</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
This space intentionally left blank. Test
@thomaswilburn
thomaswilburn / htmlparser.js
Last active June 20, 2019 14:44
A terrible HTML parser that you might be able use to scrape (well-constructed) pages from Google Apps Script
var Node = function(type) {
this.type = type;
this.tagName = null;
this.attributes = {};
this.children = [];
this.parentElement = null;
this.textContent = "";
};
Node.prototype = {
@thomaswilburn
thomaswilburn / main.js
Created May 16, 2019 14:10
Code excerpts from White Lies
var directors = {
"image": require("./image-scene"),
"audio": require("./audio-scene"),
"map": require("./map-scene")
};
// state of the last block and director
var lastBlock = null;
var director = null;
// check blocks in reverse order
@thomaswilburn
thomaswilburn / commonmark.js
Last active April 10, 2019 02:26
CommonMark-ish rendering into Google Docs
var doc = DocumentApp.getActiveDocument();
var body = doc.getBody();
function renderMD(body, lines) {
if (typeof lines == "string") {
lines = lines.split("\n");
}
lines.forEach(function(line) {
if (line.match(/^[-=+]+$/)) {
return body.appendHorizontalRule();
@thomaswilburn
thomaswilburn / generators.js
Last active September 14, 2018 18:57
CSV iterators
// test data -- we also use an identical "test.csv" to check streams
var csv = `
one,two,three
1,2,3
a,b,c
"1,000",1000,"hey there"
`.trim();
// easy numeric indexes for iterables
var forEach = function*(iter) {
@thomaswilburn
thomaswilburn / shadowpuppet.js
Last active July 3, 2018 22:42
One-way databinding
/*
A library for wiring a state object up to HTML
- [data-bound] = Sets the innerHTML of the element
- [:attributeName] or [attr:attributeName] = Sets the value of attributeName
- [class:className] = Toggles className based on truthiness
- [on:event] = Bind event listeners to this element
It's like an unholy fusion of Vue and Backbone. Call set() on the state object to trigger a render.