When you start learning node.js you soon stumble upon something called EventEmitter. The following post covers how the built-in EventEmitter works, how you can use and why it is so useful.
In node.js, you are often confronted with streams that you may want to send and recieve data over. The following post provides and explains a small helper function that allows you to extract newline-separated messages from a node.js stream.
When first confronted with node.js, you are not only presented with a completely new programming environment. You also encounter what is often referred to as callback hell accompanied by weird unfamiliar programming patterns. One of these is the way node treats callback functions.
The following post explains the conventions that node.js uses for its callback patterns (referred to as Continuation-passing style) and how you should implement them in order to comply.
Given the following problem: You have an express based webserver and you have stored all your routes in seperate files in one folder, perhaps even organized into several subfolders. You now want an easy way to apply all routes with as little effort as possible..
Meet node-walker: This little module let’s you crawl a subfolder and perform a callback on each filename that it encounters, including files in subdirectories.
Use node-walker to recursively walk over a directory and all its files. You can then iterate over all filenames to i.e. require them all one after the other. Can be installed through npm as well: npm install node-walker
Earlier I wrote a little tutorial on how to get started with node.js on windows, which I now want to continue by explaining how to setup and use MongoDB with node.js in a Windows environment. This tutorial will cover:
- Brief introduction to MongoDB
- Installation and setup of a MongoDB database server.
- Connecting to MongoDB using node and node-mongodb-native
- Basic database operations through node
The following tutorial will give you a very brief guide on how to get started with node.js on Windows. This tutorial will not tell you which third-party tools to use, this is just a plain introduction to the node.js ecosystem. This includes:
- Install and setup node.js on windows.
- Run a “Hello world!”-program.
- Create a webserver program.
- Use npm to install a module.
I came to the realisation that I get mad whenever I accidently paste formatted text and that I am too lazy to use CTRL + SHIFT + V, so I wrote a tiny Google Chrome extension that removes formatting and markup information from text that you copy to your clipboard: Plain Text Copy And Paste
I just updated the Bookmark Buttons Startpage to version 1.2.2 which fixes a problem that is recognized by the current version of Google Chrome, but not by the previous ones. Also the webstore presentation was updated in order to comply with the new formats.
The extension should update automatically over the next days, but you can manually update it if you go to the extension management window and hit the “Update all extensions” button.
As a sidenote: Chrome 15 does now throw a fatal error when a new RegExp object is created with unrecognized / invalid flags. Turns out that JavaScript does not support the /s flag.
I rewrote a solution by John Resig to create simple templates in JavaScript to work with node.js and added support for file loading and inline templates. Check out the examples for more information.