Skip to content

Instantly share code, notes, and snippets.

View piperhaywood's full-sized avatar

Piper Haywood piperhaywood

View GitHub Profile
@andyrbell
andyrbell / scanner.sh
Last active April 5, 2024 09:01
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@paulirish
paulirish / what-forces-layout.md
Last active April 25, 2024 21:49
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@magicznyleszek
magicznyleszek / random-non-overlapping-position.js
Last active April 11, 2022 21:37
JavaScript -- get random non-overlapping position
// declarations
var positions = [];
// Returns a random integer between min (included) and max (excluded)
// Using Math.round() will give you a non-uniform distribution!
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
// generate random positions
@netpoetica
netpoetica / ImportSVGToSymbol.html
Created January 8, 2013 05:06
In Paper.js, use importSVG to import an svg node to a useable symbol and remove it from the DOM.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Paperjs - ImportSVG to Symbol</title>
<script type="text/javascript" src="js/lib/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
function SVGSymbol(elem){
var a = new Symbol(paper.project.importSvg(elem));
elem.parentNode.removeChild(elem);
@malarkey
malarkey / Three Wise Monkeys.md
Created December 2, 2012 14:26
Three Wise Monkeys (NDA)

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?

@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………