(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #!/usr/bin/env node | |
| var program = require('commander'); | |
| var request = require('request'); | |
| var chalk = require('chalk'); | |
| program | |
| .version('0.0.1') | |
| .usage('[options] <keywords>') | |
| .option('-o, --owner [name]', 'Filter by the repositories owner') |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Copyright (C) 2014 ADDY OSMANI <addyosmani.com> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
| var gulp = require('gulp'), | |
| sass = require('gulp-sass'), | |
| browserify = require('gulp-browserify'), | |
| concat = require('gulp-concat'), | |
| embedlr = require('gulp-embedlr'), | |
| refresh = require('gulp-livereload'), | |
| lrserver = require('tiny-lr')(), | |
| express = require('express'), | |
| livereload = require('connect-livereload') | |
| livereloadport = 35729, |
| alias ng="npm list -g --depth=0 2>/dev/null" | |
| alias nl="npm list --depth=0 2>/dev/null" |
| -- Adapted from these sources: | |
| -- http://peterdowns.com/posts/open-iterm-finder-service.html | |
| -- https://gist.github.com/cowboy/905546 | |
| -- | |
| -- Modified to work with files as well, cd-ing to their container folder | |
| on run {input, parameters} | |
| tell application "Finder" | |
| set my_file to first item of input | |
| set filetype to (kind of (info for my_file)) | |
| -- Treats OS X applications as files. To treat them as folders, integrate this SO answer: |
| //Allowing CORS (Cross-Origin Resource Sharing) requests from | |
| // grunt server, put this into Gruntfile.js | |
| grunt.initConfig({ | |
| connect: { | |
| livereload: { | |
| options: { | |
| port: 9000, | |
| hostname: 'localhost', | |
| middleware: function (connect) { | |
| return [ |
| { | |
| // -------------------------------------------------------------------- | |
| // JSHint Configuration, Strict Edition | |
| // -------------------------------------------------------------------- | |
| // | |
| // This is a options template for [JSHint][1], using [JSHint example][2] | |
| // and [Ory Band's example][3] as basis and setting config values to | |
| // be most strict: | |
| // | |
| // * set all enforcing options to true |
| // Simulating infinite-length leading lookbehind in JavaScript. Uses XRegExp. | |
| // Captures within lookbehind are not included in match results. Lazy | |
| // repetition in lookbehind may lead to unexpected results. | |
| (function (XRegExp) { | |
| function prepareLb(lb) { | |
| // Allow mode modifier before lookbehind | |
| var parts = /^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*)\)$/.exec(lb); | |
| return { |
| Handlebars.registerHelper('getTimeElapsed', function(startDate, endDate) { | |
| var duration, timeElapsed, timeRemaining, now = moment(); | |
| if (moment(now).diff(endDate) > 0) { | |
| return '100'; | |
| } else { | |
| var timeRemaining = (100 / moment(endDate).format('D')) * moment(startDate).format('D'); | |
| return new String(timeRemaining).substring(0,2); | |
| } | |
| }); |