Skip to content

Instantly share code, notes, and snippets.

Avatar

Trevor Sayre TrevorSayre

View GitHub Profile
@hageldave
hageldave / BarycentricGradientPaint.java
Last active Jan 3, 2022
A java.awt.Paint implementation for triangular color interpolation (using barycentric coordinates). The svg file shows the result of the demo app (embedded image).
View BarycentricGradientPaint.java
/* Copyright 2021 David Haegele - Source from JPlotter */
import java.awt.Color;
import java.awt.Paint;
import java.awt.PaintContext;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
@cowboy
cowboy / jQuery-deferreds-wtf-anger.js
Last active Aug 29, 2015
Man, jQuery Deferreds annoy the fuck out of me.
View jQuery-deferreds-wtf-anger.js
// When a jQuery deferred is resolved with a single value, the arguments to
// the .then callback are the same as when .then is called directly on the
// deferred or on $.when(deferred) AND ALSO $.when(deferred, deferred).
var dfd = $.Deferred().resolve([1, 2, 3]);
dfd.then(function(a) {
console.log('[1a]', a); // [1, 2, 3]
});
$.when(dfd).then(function(a) {
console.log('[2a]', a); // [1, 2, 3]
});
@tbranyen
tbranyen / defines.js
Last active Feb 1, 2018
AMD Flavors.
View defines.js
// Anonymous empty module.
define();
// Anonymous values.
define({});
define(true);
define(1234);
define(null);
define(undefined);
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active Jan 19, 2022
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@rhysforyou
rhysforyou / gist:4417106
Last active Dec 10, 2015 — forked from statico/gist:3172711
A step-by-step guide on using a PS3 controller with OS X
View gist:4417106

How to use a PS3 controller on Mac OS X 10.8 (Mountain Lion)

  1. Open Apple menu → System Preferences → Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.