Skip to content

Instantly share code, notes, and snippets.

Avatar

Joshua Jacobson jmjpro

View GitHub Profile
@jmjpro
jmjpro / pconsole.js
Last active Feb 1, 2017
wrap all console log methods with a specified prefix
View pconsole.js
// 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) {
View gist:0b8c5a05b56c55360acc
{
"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 / gist:9956487
Last active Aug 29, 2015
Microdata review without ratings attempt 1
View gist:9956487
<!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:9955760
Last active Aug 29, 2015
Microdata review with ratings
View gist:9955760
<!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:6073144
Last active Dec 20, 2015
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.
View gist:6073144
du -aBM --max-depth=1 2> /dev/null | sort -rn
@jmjpro
jmjpro / canvas.html
Last active Dec 18, 2015
rotate an image on an HTML5 canvas
View canvas.html
<html>
<head>
<style>
img {
display:none;
}
</style>
<script src="canvasUtil.js"></script>
</head>
<body>