Skip to content

Instantly share code, notes, and snippets.

$$('[aria-label="Not interested"]').forEach(b => b.click())
@stoyan
stoyan / cleanup.js
Last active August 30, 2018 16:06
Script to lint and unit-test a JavaScript book written in AsciiDoc
// cleanup the extra markup to make it valid AsciiDoc
const clean = require('fs').readFileSync('2.primitive.asciidoc').toString().split('\n').filter(line => {
if (line.indexOf('/*nolint*/') === 0 ||
line.indexOf('/*global') === 0 ||
line.indexOf('/*jshint') === 0) {
return false;
}
return true;
})
.join('\n')
@stoyan
stoyan / jsdaybr.js
Created December 12, 2020 20:40
Slides from JSDay Brazil 2020
React State Management
JSDay🇧🇷 Recife 2020
@stoyanstefanov
phpied.com
<IfModule mod_rewrite.c>
# BEGIN Force http to https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{HTTP_HOST}/$1 [R=301,L]
# END Force http to https
</IfModule>
<IfModule mod_rewrite.c>
let i = document.querySelector('input.waterfall-transparency');
let up = true;
i.value = parseFloat(i.min);
i.dispatchEvent(new Event('change'));
function animate() {
const curr = parseFloat(i.value);
const max = parseFloat(i.max);
const min = parseFloat(i.min);
const step = parseFloat(i.step);
i.value = up ? curr + step : curr - step;
@stoyan
stoyan / topx.js
Created September 14, 2022 20:30
top chrome extensions
// data from https://github.com/DebugBear/chrome-extension-list
const data = require('./extensions-2021.json');
const topx = {};
data.forEach(x => {
if (x.installs !== "10,000,000+") {
Object.keys(topx).sort().forEach(key => {
console.log(topx[key]);
})
process.exit();
}