Skip to content

Instantly share code, notes, and snippets.

View MattMcFarland's full-sized avatar

Matt McFarland MattMcFarland

  • Software Engineer
  • Dayton, OH
View GitHub Profile
@MattMcFarland
MattMcFarland / failure-example.js
Last active March 15, 2017 06:58
An example of what happens when JS Verify fails a test
const jsc = require('jsverify')
// With property based testing, we don't check for specific inputs and outputs, instead we are testing the boundaries of our code.
const additionIsCommunative = jsc.checkForall(jsc.integer, jsc.integer,
(a, b) => a + b === b + a)
const multiplicationIsDistributive = jsc.checkForall(jsc.integer, jsc.integer, jsc.integer,
(a, b, c) => a * (b + c) === a * b + a * c)
const subtractionIsCommutative = jsc.checkForall(jsc.integer, jsc.integer,
(a, b) => a - b === b - a)
// log out whether or not the test passed
console.log({ additionIsCommunative, multiplicationIsDistributive, subtractionIsCommutative })
@MattMcFarland
MattMcFarland / index.js
Last active August 15, 2016 17:44
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var choo = require('choo')
var html = require('choo/html')
const app = choo()
app.model({
state: { code: 'console.log("hello world");' },
@MattMcFarland
MattMcFarland / index.js
Created August 15, 2016 17:31
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var choo = require('choo')
var html = require('choo/html')
const app = choo()
app.model({
state: { code: 'console.log("hello world");' },
@MattMcFarland
MattMcFarland / index.js
Last active October 14, 2016 17:29 — forked from willkessler/index.js
requirebin sketch
const choo = require('choo')
const html = require('choo/html')
const app = choo()
app.model({
state: { title: 'Set the title' },
reducers: {
update: (action, state) => ({ title: action.value })
}
})
@MattMcFarland
MattMcFarland / index.js
Created July 21, 2016 12:30
requirebin sketch
const choo = require('choo');
const html = require('choo/html');
const marked = require('marked');
const app = choo();
app.model({
namespace: 'choodown',
state: {
text: ''
},
@MattMcFarland
MattMcFarland / index.js
Created July 21, 2016 12:30
requirebin sketch
const choo = require('choo');
const html = require('choo/html');
const marked = require('marked');
const app = choo();
app.model({
namespace: 'choodown',
state: {
text: ''
},
@MattMcFarland
MattMcFarland / index.js
Created July 18, 2016 17:33
requirebin sketch
const choo = require('choo');
const html = require('choo/html');
const marked = require('marked');
const app = choo();
app.model({
namespace: 'choodown',
state: {
text: ''
},
@MattMcFarland
MattMcFarland / styles.less
Created July 15, 2016 17:00
Ligature fonts for atom
atom-text-editor {
font-family: 'Fira Code';
font-style: normal;
text-rendering: optimizeLegibility;
}
atom-text-editor::shadow {
.string.quoted,
.string.regexp {
-webkit-font-feature-settings: "liga" off, "calt" off;
}
@MattMcFarland
MattMcFarland / watch.js
Created May 26, 2016 15:24
node js watch, run mocha on __tests__, run eslint on files, syntax checking
import sane from 'sane';
import { resolve as resolvePath } from 'path';
import { spawn, fork } from 'child_process';
import { existsSync as fileExists} from 'fs';
import {
red, green, yellow, blue,
magenta, cyan, white, gray
} from 'chalk';
process.env.PATH += ':./node_modules/.bin';