Skip to content

Instantly share code, notes, and snippets.

function currify(f) {
return function _currify(flen, _f) {
return (...args) => {
var remaining = flen - args.length;
return remaining <= 0 ?
_f(...args) :
_currify(remaining, (...args2) => _f(...args, ...args2));
};
}(f.length, f);
}
@monolithed
monolithed / index.js
Created December 7, 2015 12:24 — forked from lygaret/index.js
ES6 Quasi-Literal for JSX
define(function(require) {
var React = require('react');
var paramRegex = /__(\d)+/;
var parser = new DOMParser();
var errorDoc = parser.parseFromString('INVALID', 'text/xml');
var errorNs = errorDoc.getElementsByTagName("parsererror")[0].namespaceURI;
// turns the array of string parts into a DOM
// throws if the result is an invalid XML document.
@monolithed
monolithed / gist:7a0ffc4e94ffc62dee84
Last active September 11, 2015 11:31 — forked from yano3/gist:1378948
git commit --amend --reset-author
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email [email protected]
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
@monolithed
monolithed / Lazy.js
Created September 2, 2015 10:29
Lazy evaluation
var fn = function (x) { return x; }
var test = function (x) {
var a = fn(x);
test = function (x) {
return a + x;
}
return test.apply(this, arguments);
@monolithed
monolithed / ie-bad_entities.js
Created August 19, 2015 07:27
ie-bad_entities
var bad_entities = [
"quot","amp","apos","lt","gt","nbsp","iexcl",
"cent","pound","curren","yen","brvbar","sect","uml","copy",
"ordf","laquo","not","shy","reg","macr","deg","plusmn",
"sup2","sup3","acute","micro","para","middot","cedil",
"sup1","ordm","raquo","frac14","frac12","frac34",
"iquest","Agrave","Aacute","Acirc","Atilde","Auml",
"Aring","AElig","Ccedil","Egrave","Eacute","Ecirc",
"Euml","Igrave","Iacute","Icirc","Iuml","ETH",
"Ntilde","Ograve","Oacute","Ocirc","Otilde",
@monolithed
monolithed / es2015-callable.js
Last active August 29, 2015 14:26 — forked from DmitrySoshnikov/es2015-callable.js
es2015-callable.js
/**
* Callable objects in ES2015.
* by Dmitry Soshnikov <[email protected]>
* MIT Style License
*/
class Callable extends Function {
constructor() {
super('(' + Callable.prototype.__call__ + ')();');
return this.bind(this);
require "try-catch"
try {
function()
error('oops')
end,
catch {
function(error)
print('caught error: ' .. error)
/**
* performance-timing.js: Polyfill for performance.timing object
* For greatest accuracy, this needs to be run as soon as possible in the page, preferably inline.
* The values returned are necessarily not absolutely accurate, but are close enough for general purposes.
* @author ShirtlessKirk. Copyright (c) 2014.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
(function (window) {
'use strict';
/*globals DOMImplementation, ActiveXObject */
if (!DOMImplementation.prototype.createDocument) {
(function () {
'use strict';
var i, docObj, docObjType,
docObjs = [
'MSXML6.DOMDocument', 'MSXML5.DOMDocument', 'MSXML4.DOMDocument',
'MSXML3.DOMDocument', 'MSXML2.DOMDocument.5.0', 'MSXML2.DOMDocument.4.0',
'use strict';
/**
* @class
* @param {number} size
*/
export default class FixedList {
constructor (size) {