Skip to content

Instantly share code, notes, and snippets.

View bryanbuchanan's full-sized avatar

Bryan Buchanan bryanbuchanan

View GitHub Profile
@bryanbuchanan
bryanbuchanan / retinacanvas.js
Last active December 16, 2015 10:59
Makes HTML5 canvas elements support @2x displays by doubling their size, then scaling them down to 50%. Requires jQuery.
// Function
function retinaCanvas($canvas, context) {
$canvas.each(function() {
$(this).prop({
width: $(this).width() * 2,
height: $(this).height() * 2
});
context.scale(2,2);
});
}
@bryanbuchanan
bryanbuchanan / logger.js
Last active October 13, 2015 23:38
Wrapper for console.log command
// Logger only works when develop == true
var develop = true;
function log(message, line) {
if (window.console && window.log && develop) {
var line = typeof line !== "undefined" ? line : false;
if (line) {
if (typeof message === "string") {
console.log(message + " (Line " + line + ")");
} else {