Created
May 17, 2010 00:54
-
-
Save beastaugh/403284 to your computer and use it in GitHub Desktop.
Run JavaScript from TextMate
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 sys = require("sys"), | |
fs = require("fs"), | |
sc = process.binding('evals').Script; | |
this.run = function(path) { | |
var contents = fs.readFileSync(path.toString()), | |
context = {print: function(v) {sys.puts(v + "<br>")}}, | |
evaled = sc.runInNewContext(contents, context); | |
}; |
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
#!/usr/bin/env node | |
var nodeTM = require('/path/to/node_tm'); | |
nodeTM.run([process.ENV.TM_FILEPATH]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment