I've released a lightweight, but extensible, logging and debugging library for node.js called Logr.
Check out logr here
I've released a command line utility for node.js called markx. Markx takes markdown files with code snippets and turns them into html. This is handy for github readme files, github pages and creating flat file blog posts.
Check out markx here
If you've used jQuery before, you are probably familiar with the extend function. If you need to be reminded... the gist of it is that you can extend an object with another object. For example, if you had a plugin that had some defaults (delay: 3000, auto: true) and you wanted to allow for developers to override them (delay: 5000), you could take in an options object and combine the two objects (delay: 5000, auto: true). Aug is a tiny (354 bytes) library that will let you do that without jQuery. I've modeled the syntax to be identical to jQuery. I've also added the ability to augment javascript classes (adding to the prototype). Here are some examples:
//Great for overriding defaults
var a = { a: 1 };
var b = { a: 2, b: 3 };
aug(a, b); //a = { a: 2, b: 3};
//Combining two objects without overriding
var a = { a: 1 };
var b = { b: 3 };
var c = aug({}, a, b); //c = { a: 1, b: 3};
//Extending a prototype
var Class1 = function() { };
Class1.prototype.test = function() {
return 0;
};
aug(Class1, {
test2: function() {
return 5;
}
});
var c = new Class1();
c.test(); //returns 0;
c.test2(); //returns 5
If you want to try out aug. Check out this jsfiddle.
You can grab the library here or check out the source in github.
For you nerds, the library has AMD and node.js support.
npm install aug
I've been looking around for a good syntax highlighting library that I could use for this blog. I found Highlight.js which is an awesome syntax highlighter for the browser, but it didn't have node support built in - and by the sound of a few issues I was tracking, he didn't want support added. Github to the rescue! I've forked highlight.js to add node.js support as well as added it to the npm library. You can get all of the syntax highlighting awesomeness of highlight.js, now on the server side (performance+). I'm going to be tracking his repo and updating npm whenever new commits are added.
Example Code:
var hl = require("highlight.js");
var txt = "var test = 'asdf'";
var html = hl.highlightAuto(txt);
console.log(html.value);
Example Output:
<span class="keyword">var</span> test = <span class="string">'asdf'</span>
To Install:
npm install highlight.js
Source: View on Github
I've stumbled upon an awesome service called Loggly. Loggly takes all your logs and lets you easily search and graph through them. I had been looking for a good way to track all the api requests and stock data for StockGlance and this seemed like the perfect tool. Winston already has a loggly transport, so all I had to do was enable it. It was almost too easy getting all of my data into loggly. What wasn't easy was a way to view all the stats that I was tracking on one screen. In comes Loggly Dashboard. I've built a simple node.js app where you can easily configure dashboard widgets to show all of your most important metrics on one screen.
Here's my dashboard for my blog:
![]()
Here's the code and to how set everything up: github. Fork away!