Skip to content

Instantly share code, notes, and snippets.

View tomeightyeight's full-sized avatar
:octocat:
Hello, World!

Tom Humphris tomeightyeight

:octocat:
Hello, World!
View GitHub Profile
@tomeightyeight
tomeightyeight / js-modules
Created October 29, 2015 11:55
Revealing Module Pattern Example
var jquery = require('jquery');
var dummy = (function($) {
"use strict";
var _privateMethod = function() {
console.log('privateMethod');
};
var publicMethod = function() {
@keyframes jelly-pop { 0% { opacity: 0; transform: matrix3d(0.1, 0, 0, 0, 0, 0.1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
3.4% { opacity: 1; transform: matrix3d(0.384, 0, 0, 0, 0, 0.466, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
4.7% { transform: matrix3d(0.505, 0, 0, 0, 0, 0.639, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
6.81% { transform: matrix3d(0.693, 0, 0, 0, 0, 0.904, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
9.41% { transform: matrix3d(0.895, 0, 0, 0, 0, 1.151, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
10.21% { transform: matrix3d(0.947, 0, 0, 0, 0, 1.204, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
13.61% { transform: matrix3d(1.111, 0, 0, 0, 0, 1.299, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
14.11% { transform: matrix3d(1.127, 0, 0, 0, 0, 1.298, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
17.52% { transform: matrix3d(1.187, 0, 0, 0, 0, 1.216, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
18.72% { transform: matrix3d(1.191, 0, 0, 0, 0, 1.169, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
@tomeightyeight
tomeightyeight / fetch-client.js
Created January 5, 2017 16:18 — forked from bryanrsmith/fetch-client.js
A thin wrapper library around the fetch API to provide application-wide HTTP client configuration
export class HttpClient {
constructor(defaults) {
this.defaults = defaults;
this.interceptors = [];
this.activeRequestCount = 0;
this.isRequesting = false;
}
addInterceptor(interceptor) {
this.interceptors.push(interceptor);
fetch has yet to provide a standard way of aborting a request. Therefore, there's no way to implement connection timeout. (#27)
fetch has failed to provide an API to set response timeout. (#20)
...which means that you'll have to wait until the end of the response or the occurrence of a network error.
...or, use setTimeout or Promise.race to manually reject the returned promise if you need a timeout. And it has a tiny side effect (#175):
mislav commented on 29 Jul 2015
Also note that with the above implementation, even if the timeout happens, the original request won't be aborted because we don't have an API to abort fetch requests. Instead, the request will complete in the background but its response will get discarded.
@tomeightyeight
tomeightyeight / cloudSettings
Last active December 6, 2017 20:04
Visual Studio Code Sync Settings Gist
{"lastUpload":"2017-12-06T20:04:26.928Z","extensionVersion":"v2.8.6"}

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@tomeightyeight
tomeightyeight / README.markdown
Created July 28, 2017 09:54 — forked from marijn/README.markdown
List of nationalities in YAML, CSV and TXT format

List of nationalities

It's time someone compiled a list of nationalities to use within a web application. This gist attempts to make a first move at that.

##List of countries

I've also compiled a list of countries

@tomeightyeight
tomeightyeight / cloudSettings
Created December 7, 2017 16:38
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-12-07T16:36:41.624Z","extensionVersion":"v2.8.6"}
@tomeightyeight
tomeightyeight / cloudSettings
Last active September 30, 2019 12:12
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-09-30T12:12:18.828Z","extensionVersion":"v3.4.3"}
@tomeightyeight
tomeightyeight / simple-https-server.py
Created July 18, 2018 10:32
SimpleHTTPServer with SSL
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl