Skip to content

Instantly share code, notes, and snippets.

@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();
}
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;
<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>
@stoyan
stoyan / jsdaybr.js
Created December 12, 2020 20:40
Slides from JSDay Brazil 2020
React State Management
JSDay🇧🇷 Recife 2020
@stoyanstefanov
phpied.com
@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')
$$('[aria-label="Not interested"]').forEach(b => b.click())
<script>
document.getElementById('wrapper').addEventListener('click', function(event) {
var checkbox = event.target.querySelector('input[type=checkbox]');
if (checkbox) {
checkbox.checked = !checkbox.checked;
}
}, true);
</script>
From b62bc38b72a6646cd4cb87a84355a7e8c2720e8f Mon Sep 17 00:00:00 2001
From: Stoyan <[email protected]>
Date: Wed, 18 Jan 2017 18:14:39 -0800
Subject: [PATCH] Exif tool based on FAIL
---
README.md | 6 +-----
manifest.json | 6 +++---
package.json | 5 +++--
public/exif-icon.png | Bin 0 -> 620 bytes
@stoyan
stoyan / clean.js
Created February 21, 2013 17:04
AsciiDoc unit test cleanup
var clean = require('fs').readFileSync('book.asc').toString().split('\n').filter(function(line) {
if (line.indexOf('/*nolint*/') === 0 ||
line.indexOf('/*global') === 0 ||
line.indexOf('/*jshint') === 0) {
return false;
}
return true;
})
.join('\n')
.replace(/--\+\+--/g, '--')
@stoyan
stoyan / test.js
Created February 12, 2013 05:47
AsciiDoc unit test
// dependencies where I can see them
var assert = require('assert');
var fs = require('fs');
var jslint = require('jshint').JSHINT;
// buncha vars
var snip, rawsnip, start = false, skipping = false, collecting = false;
var passed = 0, skipped = 0;
var lints = 0, nolints = 0;