Skip to content

Instantly share code, notes, and snippets.

Raymond Hill gorhill

  • Canada / Québec
Block or report user

Report or block gorhill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View background.js
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>' ] },
View content.js
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 Jul 16, 2017
Clean imgur on mobile
View imgur.filters.txt
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 Aug 2, 2019
Disqus comments widget: on-demand
View gist:ef1b62d606473c68d524
! 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
View gist:b44bea8f9499f22c3850
||connectormwi.laterpay.net/*/app-de-de.js$script,domain=sport1.de
View grub-install.sh
#!/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
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.
View plusd-d3timeline.html
<!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 Jul 19, 2019
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.
View render_number.go
/*
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
You can’t perform that action at this time.