Skip to content

Instantly share code, notes, and snippets.

View thomaswilburn's full-sized avatar
🦝

Thomas Wilburn thomaswilburn

🦝
View GitHub Profile
@thomaswilburn
thomaswilburn / localhost.rst
Created March 6, 2015 16:50
Instructions for AJAX testing

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
thomaswilburn / button.js
Last active August 29, 2015 14:16
Sample code report for WEB150
/**
* Originally taken from:
* https://raw.githubusercontent.com/GoogleChrome/devsummit/7ba921827a7cd080e31291275c0eda394ec21c9d/src/static/scripts/components/button.js
*
* This code enables the "material ripple" animation on buttons for the Chrome Dev Summit
* site (https://developer.chrome.com/devsummit/). 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">
@thomaswilburn
thomaswilburn / k&r-1-24.c
Last active November 7, 2018 18:27
K&R exercise 1-24
#include <stdio.h>
//I really want to use exit(), so sue me.
#include <stdlib.h>
#define true 1
#define false 0
//machine states
#define SOURCE 1 //regular code
#define COMMENT 2 //currently in a comment
@thomaswilburn
thomaswilburn / k&r-1-13.c
Created April 7, 2015 15:03
K&R Exercise 1-13
#include <stdio.h>
#define true 1
#define false 0
#define LEN 30
void main()
{
int c, length, highest;
int counts[LEN];
/*ROUTE CODE*/
server.route({
method:"GET",
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", {
@thomaswilburn
thomaswilburn / index.html
Created July 10, 2015 15:36
Weekly JS Challenge #1
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Weekly JS Challenge #1</title>
<style>
.movie-container {
display: flex;
background: #333;
max-width: 620px;
@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 / 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
@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: