... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
(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.
| # --------------------------------------------------------------------------- | |
| # | |
| # Description: This file holds all my BASH configurations and aliases | |
| # | |
| # Sections: | |
| # 1. Environment Configuration | |
| # 2. Make Terminal Better (remapping defaults and adding functionality) | |
| # 3. File and Folder Management | |
| # 4. Searching | |
| # 5. Process Management |
| var source = require('vinyl-source-stream'); | |
| var gulp = require('gulp'); | |
| var gutil = require('gulp-util'); | |
| var browserify = require('browserify'); | |
| var reactify = require('reactify'); | |
| var watchify = require('watchify'); | |
| var notify = require("gulp-notify"); | |
| var scriptsDir = './scripts'; | |
| var buildDir = './build'; |
| " Use Vim settings, rather then Vi settings (much better!). | |
| " This must be first, because it changes other options as a side effect. | |
| set nocompatible | |
| " ================ General Config ==================== | |
| set number "Line numbers are good | |
| set backspace=indent,eol,start "Allow backspace in insert mode | |
| set history=1000 "Store lots of :cmdline history | |
| set showcmd "Show incomplete cmds down the bottom |
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "flag" | |
| "net/http" | |
| ) |
Mocking - not testing - private functions in JavaScript
Instead of trying to extract a private function, we can rely on mocking/spying. This gist shows how to use the "new Function()" constructor to replace an internal call so that we can mock, spy or stub.
Another response to @philwalton -
http://philipwalton.com/articles/how-to-unit-test-private-functions-in-javascript/
This is a followup to https://gist.github.com/dfkaye/5971486 - a suggestion for
*annotating* functions to be extracted and tested separately (publicly).
| /* | |
| In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
| server, but for some reason omit a client connecting to it. I added an | |
| example at the bottom. | |
| Save the following server in example.js: | |
| */ | |
| var net = require('net'); |
| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "io" | |
| "log" | |
| "mime/multipart" | |
| "net/http" | |
| "os" |