This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function imgToDataUrl(imgEl) { | |
var canvas = document.createElement("canvas"); | |
canvas.width = imgEl.width; | |
canvas.height = imgEl.height; | |
// Copy the image contents to the canvas | |
var ctx = canvas.getContext("2d"); | |
ctx.drawImage(imgEl, 0, 0, imgEl.width, imgEl.height); | |
// Get the data-URL formatted image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var U = require('underscore'); | |
var sites = [ | |
{"name" : "a", "time":4 }, | |
{"name" : "b", "time":5 }, | |
{"name" : "c", "time":6 }, | |
{"name" : "d", "time":7 }, | |
{"name" : "e", "time":8 }, | |
{"name" : "f", "time":9 } | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This example expects to have d3.min.js and d3.layout.min.js in the same directory as pie.js and pie_serv.js. | |
Run with node pie_serv.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* MongoDB queries - http://mongodb.github.io/node-mongodb-native/markdown-docs/queries.html */ | |
hbs.registerAsyncHelper('mongo', function(options, opt2) { | |
console.log('args', arguments); // hash, inverse, fn, data | |
// console.log('name', name, "context", context); | |
// cb("async!!!!!"); | |
var queryOptions = {}; | |
if ( U.has(options.hash, "limit") && options.hash.limit.match(/^\d+$/) ) { | |
queryOptions.limit = parseInt(options.hash.limit); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var U = require('./underscore-min.js'); | |
var sanitize = require('validator').sanitize; | |
var doc = | |
["form", {"class":"form-horizontal span6"}, | |
["fieldset",{}, | |
["legend","Payment"], | |
["div", {"class":"control-group"}, | |
["label", {"class":"control-label"}, "Card Holder's Name"], | |
["div", {"class":"controls"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var U = require('./underscore-min.js'); | |
var sanitize = require('validator').sanitize; | |
var doc = | |
["form", {"class":"form-horizontal span6"}, | |
["fieldset",{}, | |
["legend","Payment"], | |
["div", {"class":"control-group"}, | |
["label", {"class":"control-label"}, "Card Holder's Name"], | |
["div", {"class":"controls"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Go into the Amazon Web Console and create a new bucket. | |
2. Go into the console and enable "static hosting" for the bucket. | |
3. Setup am index doc and an error doc for the bucket. | |
4. Set the config file for the bucket. This is an example and you would need to modify this stuff. | |
#here is an example config file for the bucket | |
<RoutingRules> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ( var i = 0; i < total_tiles; i++ ) { | |
var filename = "tiles_" + i + ".png"; // current filename | |
var target = "map_" + column + "_" + row + ".png" // new filename | |
var cmd = "file " + i + " cmd> cp -f gen/" + filename + " mappy/" + target; | |
console.log(cmd); | |
//taskList.push(async.apply(child_process.exec, cmd)); | |
taskList.push(function(command) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.image.BufferedImage; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.Collection; | |
import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.atomic.AtomicInteger; |