Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am bteitelb on github.
  • I am bteitelb (https://keybase.io/bteitelb) on keybase.
  • I have a public key ASALSgAMxdtejHLiNouxCuKmBGCo9dvp_G69Qz1X3KJqrAo

To claim this, I am signing this object:

@bteitelb
bteitelb / gist:4726756
Last active December 12, 2015 06:08
json2table - convert array of objects (as array or JSON) into HTML table rows and insert them into the given tbody
// Convert array of objects (as array or JSON) into HTML table rows and insert them into the given tbody
function json2table(tbody_id, json_or_array, array_of_column_keys) {
var tr, td, tbody = document.getElementById(tbody_id);
var objs = typeof(json_or_array) == 'string' ? JSON.parse(json_or_array) : json_or_array;
for (var i = 0; i < objs.length; i++) {
tr = tbody.insertRow(tbody.rows.length);
for (var j = 0; j < array_of_column_keys.length; j++) {
td = tr.insertCell(tr.cells.length);
td.innerHTML = objs[i][array_of_column_keys[j]];
}
@bteitelb
bteitelb / gist:1423054
Created December 2, 2011 12:20
node-canvas shadowBlur test
// Step 1:
// Retrieve test image:
// wget http://s3.amazonaws.com/tastrix/440/large_orig/shiso_trans.png
//
// Step 2:
// Then, run this through node.js
//
// Step 3:
// Inspect shade_test.png; the overlayed squares have drop shadow with Gaussian blur, the circle of leaves does not
var Canvas = require('canvas')