This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
let chars = '+=[]_'; | |
let range = 6; // 5^6 < 65535 < 5^7 | |
function base5compress(input){ | |
let out=""; | |
for(let i=0; i<input.length; i+=range){ | |
let part = input.slice(i, i+range).split('').reverse(); | |
let charcode = part.reduce((acc, c) => chars.length*acc + chars.indexOf(c), 0) | |
out += String.fromCharCode(charcode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [ | |
, | |
mess = "mess", | |
message, | |
[, [{ [mess + "age"]: whoops = (() => mess)(mess) }]] | |
] = [1, undefined, undefined, [2, [(() => ({ message }))() ]]] | |
const [ | |
mess = "mess", | |
message, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Welcome! require() some modules from npm (like you were using browserify) | |
// and then hit Run Code to run your code on the right side. | |
// Modules get downloaded from browserify-cdn and bundled in your browser. | |
var reduceCSSCalc = require('reduce-css-calc') | |
console.log("test", reduceCSSCalc("calc(100% - 120px - 60px)") ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
ಠ='',ಉ=!ಠ+ಠ,ನ=!ಉ+ಠ,ಊ=ಠ+{},ಝ=ಉ[ಠ++],ಏ=ಉ[ೡ=ಠ],ಖ=++ೡ+ಠ,ತ=ಊ[ೡ+ಖ], | |
ಉ[ತ+=ಊ[ಠ]+(ಉ.ನ+ಊ)[ಠ]+ನ[ಖ]+ಝ+ಏ+ಉ[ೡ]+ತ+ಝ+ಊ[ಠ]+ಏ][ತ](ನ[ಠ]+ನ[ೡ]+ಉ[ಖ]+ಏ+ಝ+` | |
([[]+[]][+[]][[[][[[]+[][+[]]][+[]][++[++[++[++[[]][+[]]][+[]]][+[]]][+[]]]+[[]+[][+[]]][+[]][++[++ | |
[++[++[++[[]][+[]]][+[]]][+[]]][+[]]][+[]]]+[[]+[][+[]]][+[]][++[[]][+[]]]+[[]+[][+[]]][+[]][++[++[ | |
[]][+[]]][+[]]]]+[]][+[]][++[++[++[[]][+[]]][+[]]][+[]]]+[[][[[]+[][+[]]][+[]][++[++[++[++[[]][+[]] | |
][+[]]][+[]]][+[]]]+[[]+[][+[]]][+[]][++[++[++[++[++[[]][+[]]][+[]]][+[]]][+[]]][+[]]]+[[]+[][+[]]] | |
[+[]][++[[]][+[]]]+[[]+[][+[]]][+[]][++[++[[]][+[]]][+[]]]]+[]][+[]][++[++[++[++[++[++[[]][+[]]][+[ | |
]]][+[]]][+[]]][+[]]][+[]]]+[[]+[][+[]]][+[]][++[[]][+[]]]+[[![]][+[]]+[]][+[]][++[++[++[[]][+[]]][ | |
+[]]][+[]]]+[+[++[+[]][+[]]+[]+[[]+[][+[]]][+[]][++[++[++[+[]][+[]]][+[]]][+[]]]+[++[+[]][+[]]+[]][ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventEmitter extends Map { | |
on (e,f){ this.set(e, [...this.get(e)||[], f]) } | |
off(e,f){ this.set(e, (this.get(e)||[]).filter(x => f && x !== f)) } | |
emit(e,...a){ (this.get(e)||[]).map(f => f(...a)) } | |
} | |
// minified classless fit-in-a-tweet version | |
E=(M=new Map,_=e=>M.get(e)||[])=>({on(e,f){M.set(e,[..._(e),f])},off(e,f){M.set(e,_(e).filter(x=>f&&f!==x))},emit(e,a){_(e).map(f=>f(a))}}) | |
// Usage example: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debounce(func, wait = 20, options) { | |
options = Object.assign({ | |
leading: false, | |
trailing: true, | |
throttle: false | |
}, options); | |
let timeout, isWaiting = false; | |
return function debounced(...args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hurray extends Array { | |
forEach(callback){ | |
super.forEach.call(this, (...args) => callback(Hurray.iterator(...args))); | |
return this; // make forEach chainable | |
} | |
every(callback){ return super.every.call(this, (...args) => callback(Hurray.iterator(...args))) } | |
filter(callback){ return super.filter.call(this, (...args) => callback(Hurray.iterator(...args))) } | |
find(callback){ return super.find.call(this, (...args) => callback(Hurray.iterator(...args))) } | |
findIndex(callback){ return super.findIndex.call(this, (...args) => callback(Hurray.iterator(...args))) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f=_=>!_||_*f(~-_) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getAllPropertyNames(o){ return o ? Object.getOwnPropertyNames(o).concat(getAllPropertyNames(Object.getPrototypeOf(o))) : [] } | |
Object.prototype.getAllPropertyNames = function(){ return getAllPropertyNames(this) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatDate(value, format) { | |
var date = value && value instanceof Date ? value : new Date(value); | |
return format | |
.replace("YYYY", date.getFullYear().toString()) | |
.replace("YY", date.getFullYear().toString().substr(2, 2)) | |
.replace("MM", (date.getMonth() + 1).toString().replace(/^(\d)$/, '0$1')) | |
.replace("M", (date.getMonth() + 1).toString()) | |
.replace("DD", date.getDate().toString().replace(/^(\d)$/, '0$1')) | |
.replace("D", date.getDate().toString()) |