goatslacker

Feb 21

Adding a CoffeeScript project to Travis-CI

Say you have this project you wrote in CoffeeScript and you want to add it to Travis-CI

but you do not want to include the compiled output in your code repository. Well, you will need to tell Travis to compile your project first before running the tests otherwise they would fail.

But how?

Add this to your .travis.yml

before_script:
  coffee -c -o lib src

Commands under before_script run before the unit tests are ran. So use CoffeeScript to compile your project before running the tests.

You will obviously need coffee-script as a dev_dependency in your package.json

"devDependencies": {
  "coffee-script": "latest"
}

Alternatively you can just use this Cakefile and add the following to your package.json instead

"scripts": {
  "test": "cake test"
}

Feb 10

Security questions are not secure

As I was signing up for a service today, which deals with money, I was asked to go through an extensive process in the name of security.

There was a special “security picture” assigned to me to protect me from phishing.

Then there was the ridiculous password requirements:

But aside from that nonsense, the part that bothered me the most was when they asked me to set up “security questions”, you know, in case I forget my ridiculous password.

My question options were limited to a few, including these:

All of which I can easily pull the answers to from a social media site, public records, or social engineering.

Which leads me to lie on all the questions in an attempt to be “secure”.

Then I’ll not only forget my stupid 8-14 character random password with two numbers in it (was it 29 or 41?) but I’ll also forget the lies I used to answer (was I married on the moon or in the pacific ocean?).

In which I case I’m sure they’ll have a mechanism where I can contact customer support and just tell them my zip code and I’ll be granted access to my account. Everything will be ok.

Jan 17

How to obtain harmony in your node.js

UPDATE! 3rdEden has pointed out that it’s possible to get harmony in node 0.6

You can get it by using a flag when invoking node through the command line

node --harmony_typeof --harmony_block_scoping --harmony_proxies --harmony_weakmaps file.js

Or if you’re using node 0.7.x

node --harmony file.js

Harmony!!!!1


Enable ECMAScript’s new features and syntax in node point javascript.

Node unstable has just been released and with that V8 has been upgraded to 3.8.6 which contains flags for experimental language features.

By default those flags are turned off, but you can always turn them on. Here’s how:

Download node 0.7.0.

If you’ve got it cloned on git run a git fetch and then git checkout v0.7.0 otherwise read the release notes for instructions on where to download.

Set harmony flag to true in V8

Once you’ve got the source code, open up deps/v8/src/flag-definitions.h and look for Line 115

Change the flag from false to true.

DEFINE_bool(harmony, true, "enable all harmony features")

Compile Node

./configure && make && make install

Have fun!

function foo() {
  "use strict";
  let i = -1;

  for (let i = 0; i < 10; i += 1) {
    console.log(i); // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  }

  console.log(i); // -1
}

foo();

NOTE: you’ll need to use "use strict"; otherwise the code above will not run.

By doing this you’ll get:

Learn more about ES harmony