Cross-browser requestAnimationFrame in 155 bytes of JavaScript.
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
;var _ = (function () { | |
function lo() { } | |
lo.prototype = { | |
//XMLHttpRequest wrapper | |
ajax: function() { | |
var a = arguments, | |
requestData, | |
opts = { method: 'GET', data: null, url: '', async: true, done: null, fail: null, always: null }; | |
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 mune(){ | |
var a=Array.isArray(arguments[0]) ? arguments[0] : arguments; | |
for(var i=0,l=a.length,l=l>31?31:l;i<l;i++){this[a[i]] = 1 << i} | |
} |
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
var async = { | |
waterfall: function (listOfRequests, callback) { | |
var callbacks = 0; | |
function handleCallback() { | |
callbacks++; | |
if (callbacks === listOfRequests.length) { | |
callback(); | |
} else { | |
listOfRequests[callbacks](handleCallback); | |
} |
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
/* | |
Copyright (C) 2021 Pascal de Vink (Tweakers.net) | |
This library is free software; you can redistribute it and/or | |
modify it under the terms of the GNU Lesser General Public | |
License as published by the Free Software Foundation; either | |
version 2.1 of the License, or (at your option) any later version. | |
This library is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
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's cache the event | |
var priorEvt; | |
function getMousePos(evt) { | |
//set and store.. | |
priorEvt = evt = evt || priorEvt; | |
//get the bounding rectangle | |
var rect = canvas.getBoundingClientRect(); | |
//lastly, return the x and y coordinates | |
if (evt) |
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
void Main() | |
{ | |
var result = "http://localhost:3000/test.json" | |
.GetAsync() | |
.ReceiveCropFields() | |
.Dump(); | |
} | |
static class HttpResponseMessageExtensions | |
{ |
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 string2ascii(string, sep) { | |
return string.split('') | |
.map(e => e.charCodeAt(0)).join(sep ? sep : ''); | |
} | |
function string2hex(string, sep) { | |
return string.split('') | |
.map(e => e.charCodeAt(0).toString(16)).join(sep ? sep : ''); | |
} |
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 = (...fns) => { | |
const [main, ...variations] = fns.reverse() | |
const ƒunction = (...appliedArgs) => { | |
const variation = variations.find( | |
args => appliedArgs.every( | |
(appliedArg, i) => args.slice().splice(0, args.length - 1)[i] === appliedArg | |
) | |
) |
OlderNewer