Skip to content

Instantly share code, notes, and snippets.

import fetchIntercept from 'fetch-intercept';
import { refresh, REFRESH_URL } from '...';
type IDataRequest = {
[key: string]: Request;
}
export const CreateInterceptors = (() => {
let instance;

Keybase proof

I hereby claim:

  • I am tphalp on github.
  • I am thatone6uy (https://keybase.io/thatone6uy) on keybase.
  • I have a public key ASBw_sEPj5XkX-xMU2F4iWODaXabThLaj0WQOcfBUQGqPQo

To claim this, I am signing this object:

Verifying I am +tphalp on my passcard. https://onename.com/tphalp
@tphalp
tphalp / undo.js
Last active August 29, 2015 14:13 — forked from ericflo/undo.js
var UndoMixin = {
getInitialState: function() {
return {
undo: []
};
},
handleUndo: function() {
if (this.state.undo.length === 0) {
return;
@tphalp
tphalp / voucher-csv-to-html.py
Created April 21, 2014 04:27
PFSense voucher CSV to HTML with pagebreaks
#!/usr/bin/python
import os
import sys
## Modified from http://pastebin.com/6H51NcU3 to add pagebreaks to the html markup.
def csv_to_htm(filename, minutes):
outfilename = filename.split('.')[0] + '.html'
table = '<table border="0" cellspacing="0" align="center" style="border-collapse:collapse;'
/**
* Compares two software version numbers (e.g. "1.7.1" or "1.2b").
*
* This function was born in http://stackoverflow.com/a/6832721.
*
* @param {string} v1 The first version to be compared.
* @param {string} v2 The second version to be compared.
* @param {object} [options] Optional flags that affect comparison behavior:
* <ul>
* <li>
// Throttle: only execute callback if more than 'ms' has passed since last successful call
var throttle = function (ms, func) {
var last;
return function () {
var now = new Date();
if (now - last < ms) {
return;
}
func.apply(this, arguments);
last = now;
@tphalp
tphalp / jquery.textfill.js
Created March 5, 2013 19:16 — forked from juliankrispel/jquery.textfill.js
Same as https://gist.github.com/tphalp/5093228, except that this one recalculates the font size when the window is re-sized.
(function($) {
$.fn.textfill = function(maxFontSize) {
maxFontSize = parseInt(maxFontSize, 10);
return this.each(function(){
var ourText = $("span", this);
function resizefont(){
var parent = ourText.parent(),
maxHeight = parent.height(),
maxWidth = parent.width(),
fontSize = parseInt(ourText.css("fontSize"), 10),
@tphalp
tphalp / jquery.textfill.js
Last active December 14, 2015 13:28 — forked from jesstelford/jquery.textfill.js
Re-sizes text font to fill container element.
(function($) {
$.fn.textfill = function(maxFontSizePx, minFontSizePx, element) {
maxFontSizePx = parseInt(maxFontSizePx, 10);
minFontSizePx = parseInt(minFontSizePx, 10);
if (maxFontSizePx > 0 && minFontSizePx > maxFontSizePx) {
minFontSizePx = maxFontSizePx;
}
element = typeof(element) == "string" ? element : "span";
return this.each(function(){
var ourText = $(element, this),
/*global module:false*/
module.exports = function(grunt) {
var js = {
libs : [
'jquery-1.9.0.js',
'jquery-ui-sortable-1.10.0/jquery-ui-1.10.0.custom.min.js',
'bootstrap-2.2.0/js/bootstrap.min.js',
//'jquery.sortable.js',
'datepicker/js/bootstrap-datepicker.js',
'cache.js',