Fast Automatic Browserify Bundling with Beefy

If you’re a browserify user, then beefy might help you bundle your JavaScript file automatically. It is a command line tool that runs a local node server which accepts a path to the JS file (with all your require() calls) and serves the bundled asset via browserify.

Continue reading “Fast Automatic Browserify Bundling with Beefy”

Serve Your JavaScript Files Bundled using Browserify with Node Enchilada

If you’re using Browserify to bundle assets in an Express or Connect application then you may want to consider using node-enchilada middleware to faciliate your bundling process.

Continue reading “Serve Your JavaScript Files Bundled using Browserify with Node Enchilada”

Browser-Side Node.js Style Modules require() and exports with Browserify

Browserify is an excellent tool that lets you use CommonJS modules right in the browser by bundling them up into a single large file. If you are well acquainted with Node and it’s way of loading modules via require('module') and exporting them using module.exports = ..., this is the exact pattern browserify brings to the browser. Not only can you write your own modules in this format and load/export them, but you can also use those installed via npm!

Continue reading “Browser-Side Node.js Style Modules require() and exports with Browserify”

Weighted/Biased Random Number Generation with JavaScript based on Probability

weighted random post image

First of all what is weighted random ? Let’s say you have a list of items and you want to pick one of them randomly. Doing this seems easy as all that’s required is to write a little function that generates a random index referring to one of the items in the list. Sometimes plain randomness is not enough, we want random results that are biased or based on some probability. This is where a simple weighted random generation algorithm can be used.

Continue reading “Weighted/Biased Random Number Generation with JavaScript based on Probability”

Using Underscore.string for String Manipulations in JavaScript

Underscore.string is an excellent string manipulation library (or helper) for Javascript that can be used with or without the nifty Underscore.js library. It can be used client side in browsers or server side with Node.js.

Continue reading “Using Underscore.string for String Manipulations in JavaScript”

Using CoffeeScript over JavaScript in your Node.js Application or Module

If you’ve wanted to code your next Node.js app in CoffeeScript then it ain’t that hard. Since coffeescript is just a little language that compiles down to javascript it is pretty much compatible with node.js. Let’s take a look at some of the ways in which you can execute your node.js script (written in coffeescript).

Continue reading “Using CoffeeScript over JavaScript in your Node.js Application or Module”