Skip to content

Instantly share code, notes, and snippets.

@ivn-cote
ivn-cote / __tests__getStuff-test.js
Created September 13, 2017 12:47 — forked from jsdf/__tests__getStuff-test.js
Writing and testing async JS with Jest, promises and async functions
jest.dontMock('../getStuff');
describe('getStuff', () => {
let getStuff;
let request;
let stuffStore;
it('loads the data', () => {
const id = 1;
const data = {a: 1};
@ivn-cote
ivn-cote / combinators.js
Created February 11, 2016 12:23 — forked from Avaq/combinators.js
Combinators
const I = x => x;
const K = x => _ => x;
const A = f => x => f(x);
const T = x => f => f(x);
const W = f => x => f(x)(x);
const C = f => y => x => f(x)(y);
const B = f => g => x => f(g(x));
const S = f => g => x => f(x)(g(x));
const P = f => g => x => y => f(g(x))(g(y));
const Y = f => (g => g(g))(g => f(x => g(g)(x)));
// Required Modules
var webdriver = require('wd')
, assert = require('assert')
, fs = require('fs')
, mkdirp = require('mkdirp');
// Define the strings for landscape & portrait
var PORTRAIT = "PORTRAIT";
var LANDSCAPE = "LANDSCAPE";
var portrange = 45032
function getPort (cb) {
var port = portrange
portrange += 1
var server = net.createServer()
server.listen(port, function (err) {
server.once('close', function () {
cb(port)