Skip to content

Instantly share code, notes, and snippets.

View leonardfischer's full-sized avatar

Leonard Fischer leonardfischer

View GitHub Profile
@leonardfischer
leonardfischer / Pixelperfect.css
Created June 28, 2017 12:28
CSS class for disabling browser from blurring images when scaled
/* See https://stackoverflow.com/questions/14068103/disable-antialising-when-scaling-images */
img.pixelperfect,
.pixelperfect img {
image-rendering: optimizeSpeed; /* STOP SMOOTHING, GIVE ME SPEED */
image-rendering: -moz-crisp-edges; /* Firefox */
image-rendering: -o-crisp-edges; /* Opera */
image-rendering: -webkit-optimize-contrast; /* Chrome (and eventually Safari) */
image-rendering: pixelated; /* Chrome */
image-rendering: optimize-contrast; /* CSS3 Proposed */
-ms-interpolation-mode: nearest-neighbor; /* IE8+ */
@leonardfischer
leonardfischer / index.html
Last active December 16, 2021 22:27
Creating a zoom- and panable tile-grid in D3 (via SVG patterns)
<svg>
<defs>
<pattern id="inner-grid" width="10" height="10" patternUnits="userSpaceOnUse">
<rect width="100%" height="100%" fill="none" stroke="#ccc" stroke-width="0.5" />
</pattern>
<pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse">
<rect width="100%" height="100%" fill="url(#inner-grid)" stroke="#ccc" stroke-width="1.5" />
</pattern>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="url(#grid)"></rect>