Skip to content

Instantly share code, notes, and snippets.

View image72's full-sized avatar

image72 image72

View GitHub Profile
@image72
image72 / axios-timing.ts
Created August 14, 2018 03:57 — forked from forivall/axios-timing.ts
Axios Timing helper POC
import http = require('http')
import https = require('https')
import url = require('url')
import {AxiosInstance, AxiosInterceptorManager} from 'axios'
import {HttpRequestOptions as HttpFollowRequestOptions, http as httpFollow, https as httpsFollow} from 'follow-redirects'
import now = require('performance-now')
import httpAdapter = require('axios/lib/adapters/http')
import InterceptorManager = require('axios/lib/core/InterceptorManager')
@image72
image72 / nginx-webp-sample.conf
Created July 10, 2018 06:55 — forked from uhop/nginx-webp-sample.conf
Serving WEBP with nginx conditionally.
user www-data;
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
@image72
image72 / Promiser.js
Last active February 5, 2018 07:39 — forked from jasuperior/Promiser.js
An ES6 async/promise proof of concept using Proxies.
// maybe that can compose graphql api?
/*
Using Es6 Proxies, I created an object that can resolve promises from a chained object accessor pattern.
simply await the values, or supply a callback to .then() and watch the magic.
*/
Symbol.queue = Symbol("queue"); //using Symbols to hide properties from being used or altered
Symbol.data = Symbol("data");
function Promiser( obj ) {
return new Proxy(obj, {
@image72
image72 / agent.js
Created July 19, 2017 03:42 — forked from TooTallNate/agent.js
Node.js `http.Agent` class implementations...
/**
* Module dependencies.
*/
var net = require('net');
var inherits = require('util').inherits;
var EventEmitter = require('events').EventEmitter;
/**
@image72
image72 / function-bind.js
Created November 3, 2016 14:11 — forked from Daniel-Hug/function-bind.js
Polyfill for Function.prototype.bind
Function.prototype.bind=(function(){}).bind||function(b){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");}function c(){}var a=[].slice,f=a.call(arguments,1),e=this,d=function(){return e.apply(this instanceof c?this:b||window,f.concat(a.call(arguments)));};c.prototype=this.prototype;d.prototype=new c();return d;};
@image72
image72 / LICENSE.txt
Created November 3, 2016 12:42 — forked from Fedia/LICENSE.txt
John Resig's Micro-Templating in 140 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2015 Fedia <fedia@psih.ru>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@image72
image72 / fetch-client.js
Created August 26, 2016 19:38 — 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);
@image72
image72 / nginx.conf
Last active July 22, 2016 07:50 — forked from agouriou/nginx.conf
Example Nginx (> 1.9) configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs. Handle error status (4xx, 5xx) and expose headers. support subdomain
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your location block(s):
#
# include cors_support;
#
# A limitation to this method is that Nginx doesn't currently send headers
@image72
image72 / index.html
Last active July 28, 2017 06:57 — forked from anonymous/index.html
// source http://jsbin.com/weguzoh angular SPA
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.9/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.9/angular-route.min.js"></script>
<style>
a, a:hover {
text-decoration: none;
}
#content{
border:2px solid #e5e5e5;
overflow: hidden;