Skip to content

Instantly share code, notes, and snippets.

Thomas Wilburn thomaswilburn

Block or report user

Report or block thomaswilburn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
thomaswilburn /
Created Aug 29, 2014
Apps Script example for handling custom forms
var sheetID = "xxx-id-goes-here-xxx";
var rowConfig = "timestamp name location favorite note lifespan season contact lat lng zone approve feature".split(" ");
Requests may come in with the following parameters:
favorite - player name (number?)
View caret_readme.rst


Caret is a serious, graphical programmer's editor running as a Chrome Packaged App. Inspired by Sublime and built on top of the Ace editing component, it offers powerful features like:

  • multiple cursors
  • tabbed editing and retained files
  • syntax highlighting and themes
  • command palette/smart go to
  • hackable, synchronized configuration files
thomaswilburn /
Created Sep 6, 2014
Geocoding using Apps Script APIs
var sheet = SpreadsheetApp.openById(sheetID).getSheetByName("Responses");
var rowConfig = "timestamp name location favorite note lifespan season contact lat lng city zone approve feature".split(" ");
function getCol(row, param) {
return row[rowConfig.indexOf(param)];
function setCol(row, param, value) {
row[rowConfig.indexOf(param)] = value;
thomaswilburn / global_menu.php
Created Nov 19, 2014
Multi-site menu attempt
View global_menu.php
//the slot is the menu location string you registered for the global menu
$slot = "menu_name_here";
function global_multisite_nav_menu_filter( $content, $args ) {
global $slot;
$registered = get_registered_nav_menus();
if( !isset( $registered[$slot] ) )
return $content;
thomaswilburn / global_menu.php
Created Nov 20, 2014
Global menu for Wordpress that isn't a huge goddamn hack
View global_menu.php
//function for getting a global menu
//that caching plugin really was ridiculous, wasn't it?
if (is_multisite() && !is_main_site()) {
switch_to_blog(1); //should send us to the main site temporarily
wp_nav_menu("menu_id"); //get the nav menu from the main site context
if (is_multisite() && ms_is_switched()) {
restore_current_blog(); //revert to the network site if we switched it above
thomaswilburn / idbtest.js
Last active Aug 29, 2015
oh god indexeddb why
View idbtest.js
var log = console.log.bind(console);
var Database = function(name, version, upgrade) {
var self = this;
this.ready = new Promise(function(ok, fail) {
var req =, version);
req.onupgradeneeded = function(db) {
self.db_ = req.result;
if (upgrade) upgrade();
thomaswilburn / localhost.rst
Created Mar 6, 2015
Instructions for AJAX testing
View localhost.rst

Local Hosting

Getting started

There are lots of ways to run a local host, which is necessary for testing AJAX (and useful when it comes to other tasks). This document covers setting up a simple Node-based HTTP server, but you may also choose to use one of the MAMP/WAMP applications to start a local Apache instance, or use Python's simple server.

Before doing anything else, install the latest version of NodeJS. Node is a runtime for desktop/server JavaScript (as opposed to running scripts in the browser), and many useful tools are built on top of it. If you find this helpful, you may also want to look into LESS, Grunt, and other Node-based development tools.

thomaswilburn / button.js
Last active Aug 29, 2015
Sample code report for WEB150
View button.js
* Originally taken from:
* This code enables the "material ripple" animation on buttons for the Chrome Dev Summit
* site ( It finds all buttons on the page, and
* adds an animation to them that plays on click. Button elements tend to look like this:
* <button data-embed="..." class="paper-button session__fab">
* <div class="session__fab-inner">
View k&r-1-13.c
#include <stdio.h>
#define true 1
#define false 0
#define LEN 30
void main()
int c, length, highest;
int counts[LEN];
View gist:88547673c448815a9bdf
path: "/books",
handler: function(request, reply){
fs.readFile("books.json", "utf8", function(err,data){
var links =[];
var list = JSON.parse(data);
reply.view("book-list", {
You can’t perform that action at this time.