Skip to content

Instantly share code, notes, and snippets.

@dgmike
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgmike/381478f5fb60da684f96 to your computer and use it in GitHub Desktop.
Save dgmike/381478f5fb60da684f96 to your computer and use it in GitHub Desktop.
Autoloading files in node shell
/*jslint indent: 2, node: true*/
"use strict";
exports.hello = function() {
console.log("Hello World!");
};
console.log("preamble executed! poor guy!");
/* vim: set ts=2 sw=2 tw=0 et :*/
#!/bin/bash
# require("./__preamble__.js");
# repl = require("repl").start("> ");
# console.log("loaded...");
node -e 'require("./__preamble__.js"); repl = require("repl").start("> "); console.log("loaded...");'
@dgmike
Copy link
Author

dgmike commented Feb 28, 2014

Just run this using ./my_node.sh - You can use an alias too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment