nelsonic / practice

Practice makes ...
11 stars 4 forks source link

practice makes ...

fun times with code.

HTTP Referrer

Its easy to get the http Referrer ("the page that sent you to us") on the server. But right now (for work) we are building a (React) Single Page Web Application that loads from S3 (i.e. No Server!) so we need a way to get the http referred client-side.

A minute of googling revealed: https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer

So that's what this experiment attempts to use. see: /http_referrer

ES6 => Babel ... ?

ES6 has many "cool" features; some of which are (potentially) useful. If you need an intro to these have a look at https://github.com/benjaminlees/Es6

The focus of this post, however, is Babel.

Tower of Babel: https://en.wikipedia.org/wiki/Tower_of_Babel

https://babeljs.io/

Why do all babel tutorials install the module globally?

Browser Compatibility Chart: http://kangax.github.io/compat-table/es6/

Sending Email From Node.js

NodeMailer https://github.com/andris9/Nodemailer does a good job of sending email from your node.js script/app. The only drawback is that if your IP address gets blocked (because a handfull of people mark the email you send as "spam"), then you need to re-configure your settings. If you're sending thousands of emails and don't want to spend your life trawling through logs to figure out why they are getting blocked, opt to use an email service company. We opted to use Mandrill and produced a helper package: https://github.com/dwyl/sendemail (which will help you get started quickly).

ListDirs

In my quest to find the perfect module to list all directories in a project, I tested:

Switching to QUnit Full Stack!

Which QUnit Node.js Module should we use...?

The official qunitjs module (maintained by the jquery foundation): https://github.com/jquery/qunit works with istanbul. simply run: istanbul cover your-test-filename.js see: http://ariya.ofilabs.com/2012/12/javascript-code-coverage-with-istanbul.html I'm a little worried that the 1.18 release has only 84% coverage ... it doesn't make any sense.