Skip to content

Instantly share code, notes, and snippets.

var RenderObject = function(rend, drawingContext){
var currentCtx = (drawingContext !== undefined) ? drawingContext : ctx;
if ( (rend.visible == undefined) ? true : rend.visible){
currentCtx.save();
if (rend.x != undefined && rend.y != undefined)
currentCtx.translate(rend.x, rend.y);
else if (rend.loc != undefined)
currentCtx.translate(rend.loc.getX(), rend.loc.getY());
@tomshen
tomshen / sync-callbacks-promises.js
Created January 22, 2014 01:12
Demonstrating three different ways to delete files whose names are stored in an array.
var companies = [/* ... */];
/* WITH SYNC */
var fs = require("fs");
companies.forEach(fs.unlinkSync(company)); // this is blocking
console.log("All files deleted");
/* WITH CALLBACKS */
var fs = require("fs");