Skip to content

Instantly share code, notes, and snippets.

View jmjpro's full-sized avatar

Joshua Jacobson jmjpro

View GitHub Profile
@jmjpro
jmjpro / canvas.html
Last active December 18, 2015 10:59
rotate an image on an HTML5 canvas
<html>
<head>
<style>
img {
display:none;
}
</style>
<script src="canvasUtil.js"></script>
</head>
<body>
@jmjpro
jmjpro / gist:6073144
Last active December 20, 2015 04:48
Find which files/folders within a directory of files are responsible for clogging your hard drive with large files. This worked from cygwin on windows but it should work from linux as well.
du -aBM --max-depth=1 2> /dev/null | sort -rn
@jmjpro
jmjpro / gist:9955760
Last active August 29, 2015 13:58
Microdata review with ratings
<!DOCTYPE html>
<html lang="en">
<head>
<title>Proper use of reviewCount</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<body>
<div itemscope itemtype="http://schema.org/Article">
<h1 itemprop="name">Proper use of reviewCount</h1>
<div itemprop="description">Don't use reviewCount when you should use ratingCount.</div>
@jmjpro
jmjpro / gist:9956487
Last active August 29, 2015 13:58
Microdata review without ratings attempt 1
<!DOCTYPE html>
<html lang="en">
<head>
<title>Proper use of reviewCount</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<body>
<div itemscope itemtype="http://schema.org/Article">
<h1 itemprop="name">Proper use of reviewCount</h1>
<div itemprop="description">Don't use reviewCount when you should use ratingCount.</div>
{
"token": "7fe54ac8-8098-4a47-a72f-ade0276003d8",
"entity_id": "18",
"created_at": "2015-04-06 11:49:46",
"quote_id": "135",
"delivery_time_window": {
"ddate": "2015-04-27",
"dtime": "17:30-22:00"
},
"customer_id": "3",
@jmjpro
jmjpro / pconsole.js
Last active February 1, 2017 12:43
wrap all console log methods with a specified prefix
// Note: relies on es6 for..of loop and ..., the 'spread' operator; can easily be adapted to es5
function pconsole(prefix /* string */) {
// preserves original line number of calling function
// usage:
// const todo_console = pconsole('TODO');
// todo_console.log(1, 2) outputs 'TODO 1 2' and similar for debug, info, warn, etc... methods
const prefix_console = {};
const log_methods = ['debug', 'dir', 'error', 'exception', 'info', 'log', 'table', 'trace', 'warn'];
for (let method of log_methods) {