Skip to content

Instantly share code, notes, and snippets.

View gorhill's full-sized avatar

Raymond Hill gorhill

  • Canada / Québec
View GitHub Profile
var blockedRequestIds = new Set();
browser.webRequest.onBeforeRequest.addListener(
function(details) {
if ( details.url.includes('favicon') === false ) { return; }
blockedRequestIds.add(details.requestId);
console.log('blocking tabId=' + details.tabId + ' requestId=' + details.requestId + ' url=' + details.url);
return { cancel: true };
},
{ urls: [ '<all_urls>' ] },
var addedNodesCount = 0;
var removedNodesCount = 0;
var observer = new MutationObserver(function(mutations) {
var i = mutations.length;
while ( i-- ) {
var mutation = mutations[i];
addedNodesCount += mutation.addedNodes.length;
removedNodesCount += mutation.removedNodes.length;
}
console.log('addedNodesCount=' + addedNodesCount, 'removedNodesCount=' + removedNodesCount);
@gorhill
gorhill / imgur.filters.txt
Created July 16, 2017 12:48
Clean imgur on mobile
m.imgur.com##.GalleryHandler-postContainer ~ .GalleryHandler-postContainer
m.imgur.com##.getTheApp
m.imgur.com##.FloatingOIA-container
m.imgur.com##.GalleryInfiniteScroll > div > div[style^="width: 100%; height:"]
@gorhill
gorhill / gist:ef1b62d606473c68d524
Last active February 16, 2023 21:17
Disqus comments widget: on-demand
! Title: Disqus click-to-load
# Copy-paste the static filters below into your "My filters" pane in the
# dashboard.
# Purpose is to load Disqus comments on demand only, so that no connection
# to `disqus.com` occurs by default when you land on a site which uses
# Disqus comments widget.
# Not connecting to Disqus by default is a good thing for such a
# ubiquitous server as `disqus.com`, which can be used to build a
||connectormwi.laterpay.net/*/app-de-de.js$script,domain=sport1.de
#!/bin/sh
DEVICE=sdf
mkfs.vfat -n multipass01 /dev/$DEVICE1
mount /dev/$DEVICE1 /mnt/
grub-install --no-floppy --root-directory=/mnt /dev/$DEVICE
@gorhill
gorhill / plusd-d3timeline.html
Last active May 6, 2019 09:53
Bar chart experiment for Wikileaks PlusD timeline graph. Uses jQuery, d3. See in action at http://jsfiddle.net/khnxZ/#. Tested on linux Chromium & Firefox. Performance wise, Chromium does better than Firefox. Feel free to use/modify as you wish.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Bar chart experiment for WL_+D</title>
<script src="jquery.min.js"></script>
<script src="d3.v3.min.js"></script>
<style>
/* Nice, we can use CSS to configure appearance */
@gorhill
gorhill / render_number.go
Last active April 21, 2024 05:50
A Go function to render a number to a string based on the following user-specified criteria: thousands separator, decimal separator, decimal precision. I didn't feel it was worth to publish a library just for this piece of code, hence the snippet. Feel free to reuse as you wish.
/*
Author: https://github.com/gorhill
Source: https://gist.github.com/gorhill/5285193
A Go function to render a number to a string based on
the following user-specified criteria:
* thousands separator
* decimal separator