How to create a node library with scala.js

Assumes you have scala, sbt and IntelliJ installed with scala plugin

  1. Create new Scala > SBT project. Name it tutorial-lib.
  2. Add line to project/plugins.sbt: addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.14")
  3. Add lines to built.sbt:
View classes.ts
class A {
v1: string
v2: number
constructor() {
this.v1 = `Test ${this.v2}`
class B extends A {
View ONE.ts
import { TWO } from './constants'
export const ONE = TWO - 1 // i.e. this evaluates undefined - 1
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
.country {
fill: #C0D9AF;
stroke: #fff;
stroke-width: 1px;
stroke-linejoin: round;
View generators.js
Array.prototype.toIterator = function*() {
for (var i = 0, l = this.length; i < l; i++) {
yield this[i]
} = function*(lambda) {
for (var value of this) {
yield lambda(value)

The way of the substack

With over 200 modules in npm, and many such as browserify, dnode, optimist, etc. relied upon day-to-day by developers all around the world, substack is a pretty damn productive guy.

Plus, he's got an awesome philosophy on programming to boot (yes, there is a programming philosophy! ... no comprende? Let me explain later).

BTW, how do I know this? I got to talk to him at campjs as he wrote & published a module (lexical-scope to be exact). He was super friendly and shared alot of his thoughts on many topics.

All in all, it was really cool to meet someone that's completely congruent with what he says & lives out as a programmer. It almost felt Bret Victor-like.


Oz Big Data (Feb 2013) Meetup

Hadoop is based on MapReduce algorithm.


  • MapReduce is a method of parallelising data processing on several machines.
  • Map = take input and produce key value pairs
  • Reduce = aggregate values with the same key
  • Example is counting words across many documents.

Making Javascript faster

This is a list of guidelines to make your Javascript faster, often associated with jsPerf benchmarks.

Profile before optimizing

If you have an existing codebase, don't get carried away with premature optimizations. Profile to find the slow bits and pick the low hanging fruit.

Some of the latter lessons in Code School's Chrome DevTools course will teach you how to profile your code.



A flex container expands items to fill available free space, or shrinks them to prevent overflow. It only works well in Chrome at the moment.


<!DOCTYPE html>