Skip to content

Instantly share code, notes, and snippets.

@lazywithclass
Last active March 21, 2017 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazywithclass/83d36d1684665d660108acd29eac5cbd to your computer and use it in GitHub Desktop.
Save lazywithclass/83d36d1684665d660108acd29eac5cbd to your computer and use it in GitHub Desktop.
[RC Diary] Still a bit under the rejection thing (-83)

[RC Diary] Still a bit under the rejection thing (-83)

Cerebro

Moved completely to use defrecord, the project now needs some refactoring to clean things up and move functions around in their correct place.

The next step is taking care of duplicated variable declarations, the way I will do this is:

  • the source keeps its var
  • the test gets scoped in an IIFE

so the resulting code that would get passed to node's vm would for example look like

// source
function check(price, threshold) { 
  return price <= threshold 
}

module.exports = check;

// test
(function() {
 var assert = require('assert')
 var check = require('../lib/source')

 describe('simple project', function() {

   it('returns true', function() {
     assert.equal(check(10, 20), true)
   })
 })
})()

So the two declarations won't clash!

This solved the issue of the two declared checks, but require('../lib/source') still won't work. So next step is make Cerebro a command line tool that could be run in projects, as it was always meant to be.

Look like these two links would help me get started with that

Project lamp

We added a lot more in terms of functionality and polish to the introduction and first chapter.

I also went through all the code and theory, it's so fascinating! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment