In order to generate some svg with d3 in node.js, you need a dom. This is a bare bones example of using jsdom for said dom.
This file contains 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
/* | |
** | |
** Example of Interprocess communication in Node.js through a UNIX domain socket | |
** | |
** Usage: | |
** server> MODE=server node ipc.example.js | |
** client> MODE=client node ipc.example.js | |
** | |
*/ |
This file contains 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
/* | |
* CSS like attribute parsing. | |
* | |
* Parses strings like `comp[name=myComp] > layer[name=myLayer light=true selected]` to objects. | |
*/ | |
{ | |
function mergeProps(array){ | |
var merged = {}; | |
This file contains 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
docker images | tail -n +2 | grep -v "none" | awk '{printf("%s:%s\n", $1, $2)}' | while read IMAGE; do | |
echo $IMAGE | |
filename="${IMAGE//\//-}" | |
filename="${filename//:/-}.docker-image.gz" | |
docker save ${IMAGE} | pigz --stdout --best > $filename | |
done |
This file contains 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 concat = require("concat-stream"); | |
var hyperquest = require("hyperquest"); | |
var Promise = require("bluebird"); | |
var stream = require("stream"); | |
// Wait for the request to finish or fail | |
function promisify(req) { | |
return new Promise(function (resolve, reject) { | |
req.on("error", reject).pipe(concat({ encoding: "string" }, resolve)); |
This file contains 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 _ = require('underscore'); | |
var Backbone = require('backbone'); | |
var cheerio = require('cheerio'); | |
var request = require('request'); | |
Backbone.ajax = function(options) { | |
options.json = true; | |
return request(options, function(error, result) { | |
if (error) { |
This file contains 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
define([ | |
'Backbone' | |
], function( | |
Backbone | |
){ | |
// I've evalled the entire file at this point, using cmd + A, cmd + Enter | |
Backbone // cmd + Enter returns me `undefined`, although in the application, it would be the Backbone library object | |
}) |
This file contains 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
public interface FontResource extends ClientBundle | |
{ | |
FontResource INSTANCE = GWT.create(FontResource.class); | |
@Source("font1.otf") | |
DataResource font1(); | |
@Source("font2.otf") | |
DataResource font2(); |
This file contains 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
Handlebars.JavaScriptCompiler.prototype.nameLookup = function(parent, name, type) { | |
var result = '(' + parent + ' instanceof Backbone.Model ? ' + parent + '.get("' + name + '") : ' + parent; | |
if (/^[0-9]+$/.test(name)) { | |
return result + "[" + name + "])"; | |
} else if (Handlebars.JavaScriptCompiler.isValidJavaScriptVariableName(name)) { | |
return result + "." + name + ')'; | |
} else { | |
return result + "['" + name + "'])"; | |
} | |
}; |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
NewerOlder