Skip to content

Instantly share code, notes, and snippets.

@mbostock
mbostock / .block
Last active March 25, 2024 16:38 — forked from jasondavies/flare.json
Automatic Text Sizing
height: 760
license: gpl-3.0
@mbostock
mbostock / .block
Last active October 20, 2023 14:09
General Update Pattern, I
license: gpl-3.0
redirect: https://observablehq.com/@d3/selection-join
@klepikov
klepikov / Test.java
Last active August 25, 2023 03:12
Demo code for the GTAC 2013 talk "Web Performance Testing with WebDriver" by Michael Klepikov
import java.io.IOException;
import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import org.json.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.logging.*;
@brysongilbert
brysongilbert / gist:6062276
Last active March 26, 2022 00:17
CSS colour invert via SVG filter for Webkit, Firefox, and Internet Explorer 6-8.
/* WebKit */
-webkit-filter: invert();
/* Firefox */
filter: url("data:image/svg+xml;utf8,<svg height='0' xmlns='http://www.w3.org/2000/svg'><filter id='negative'><feColorMatrix values='-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0'/></filter></svg>#negative");
/* IE 6-7 */
filter: progid:DXImageTransform.Microsoft.BasicImage(invert=1);
/* IE 8 */
-ms-filter: 'progid:DXImageTransform.Microsoft.BasicImage(invert=1)';
@drinkcat
drinkcat / Performance
Last active November 28, 2019 10:32
Shell implementation of cpio
time sudo cpio -idm < ../bash-4.2-37.4.mga3.x86_64.cpiodec
Proper cpio:
real 0m0.031s
user 0m0.003s
sys 0m0.027s
Using dd:
real 0m3.277s
user 0m0.103s
@kuy
kuy / pre-commit
Last active November 10, 2021 03:52
git: pre-commit hook script to prevent committing FIXME code
#!/bin/sh
matches=$(git diff --cached | grep -E '\+.*?FIXME')
if [ "$matches" != "" ]
then
echo "'FIXME' tag is detected."
echo "Please fix it before committing."
echo " ${matches}"
exit 1
@druska
druska / native_js_drag_and_drop_helper.js
Created August 26, 2015 03:56
Create the `simulateDragDrop` function which can be used to simulate clicking and dragging one DOM Node onto another
function simulateDragDrop(sourceNode, destinationNode) {
var EVENT_TYPES = {
DRAG_END: 'dragend',
DRAG_START: 'dragstart',
DROP: 'drop'
}
function createCustomEvent(type) {
var event = new CustomEvent("CustomEvent")
event.initCustomEvent(type, true, true, null)
@kdzwinel
kdzwinel / main.js
Last active June 7, 2024 08:08
List all undefined CSS classes
/*
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets.
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there).
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ .
Known limitations:
- it won't be able to take into account some external stylesheets (if CORS isn't set up)
- it will produce false negatives for classes that are mentioned in the comments.
@veltman
veltman / README.md
Created July 11, 2016 03:05
Argyle

Infinite argyle with random ColorBrewer and d3 4.0 color scales.

@cmgiven
cmgiven / .block
Last active October 27, 2019 19:52
Interactive General Update Pattern
license: mit
height: 640