Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View voronianski's full-sized avatar

Dmytro Voronianski voronianski

View GitHub Profile
@voronianski
voronianski / simple-react-playground.html
Last active April 6, 2024 16:59
Quick React prototyping in browser on the fly with ES2015. Use this as boilerplate for your playground and upload html file on some server. Created as a solution for this challenge - http://blog.vjeux.com/2015/javascript/challenge-best-javascript-setup-for-quick-prototyping.html with the help of https://github.com/voronianski/babel-transform-in-…
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>React Quick Prototyping</title>
</head>
<body>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.min.js"></script>
console.log('hello')
@voronianski
voronianski / content-length-size.md
Last active January 19, 2021 01:08
What happens if you serve content with a different length than the Content-Length header?

@jakearchibald done a bit of research around this:

###Loading a page with Content-Length < actual content length

  • Chrome: Truncated content - no indication of error
  • Firefox: Truncated content - no indication of error
  • Safari: Truncated content - no indication of error
  • IE: Truncated content - no indication of error

###Loading a page with Content-Length > actual content length

const data = [
['My Title', 'https://example.org'],
// more...
];
const min = 1;
const max = data.length;
for (let i = min; i < max; i++) {
document.querySelector('#visual_comparison button').click();
}
@voronianski
voronianski / memoizes.js
Created November 11, 2014 19:52
Memoization implementations
// Underscore.js
_.memoize = function(func, hasher) {
var memoize = function(key) {
var cache = memoize.cache;
var address = '' + (hasher ? hasher.apply(this, arguments) : key);
if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
return cache[address];
};
memoize.cache = {};
return memoize;
(function () {
const nodes = document.querySelectorAll('button.select-menu-item[value="included');
const arr = [ ...nodes ];
arr.forEach(button => {
setTimeout(() => {
button.click();
}, 500);
});
})();
@voronianski
voronianski / esnextbin.md
Created January 17, 2019 16:47
esnextbin sketch
@voronianski
voronianski / esnextbin.md
Created November 15, 2018 15:52
test new container
@voronianski
voronianski / esnextbin.md
Last active November 15, 2018 15:47
with babel-standalone v6.26.0
@voronianski
voronianski / esnextbin.md
Last active November 15, 2018 15:35
@babel/standalone v7.1.0