Skip to content

Instantly share code, notes, and snippets.

@jmreidy
jmreidy / machine.js
Created April 29, 2020 15:33
Generated by XState Viz: https://xstate.js.org/viz
const wordMachine = Machine({
id: 'word',
type: 'parallel',
states: {
bold: {
initial: 'off',
states: {
on: {
on: { TOGGLE_BOLD: 'off' }
},
@jmreidy
jmreidy / test_mocha.opts
Last active January 9, 2018 11:49
Unit test React Native with Mocha
--compilers js:./test/support/compiler
--require ./test/support/init
import { Inject, Injectable, OpaqueToken } from 'angular2/core';
import * as Firebase from 'firebase';
import { IConfig } from '../lib/config';
export interface IFirebaseService {
ref: Firebase;
}
export const IFirebaseService = new OpaqueToken('FirebaseService');
import {Action} from '../actions/actionTypes';
import {isMatch} from 'lodash';
interface actionHandler {
(action:Action, state:any):Object;
}
export class ActionMatcher {
tests:Array<(action:Action) => boolean>;
handler:actionHandler;
/* eslint-env node, mocha */
import expect, { createSpy } from 'expect';
import { createStore } from 'redux';
import LoginScreen, { Component as LoginScreenComponent } from '../../src/containers/screens/LoginScreen';
import * as loginActions from '../../src/actions/loginActions';
describe('LoginScreen', () => {
//regular component tests
});
'use strict';
suite('Edit account', function() {
test('Change name', function(done) {
var self = this;
this.browser
.get(e2eConfig.baseUrl + "/user/edit")
.waitForElementByCss('form', self.mochaOptions.timeout);
.then(function (form) {
@jmreidy
jmreidy / todoApp.jsx
Last active January 4, 2016 01:59
modularizing jsx. Makes use of [grunt-browserify](https://github.com/jmreidy/grunt-browserify) with [reactify](https://github.com/andreypopp/reactify) for compiling JSX as a transform.
var TodoItem = require('../templates/todoItem.jsx');
//in render fn...
var todoItems = mori.into_array(mori.map(function (todo) {
idx++;
return TodoItem.call(this, todo, idx);
}.bind(this), shownTodos));
@jmreidy
jmreidy / 1-index.js
Created June 19, 2013 15:59
A quick browserify rundown
//assume that Backbone and $ are available as globals
//everything in this file will be interpretted as soon as the JS is
//loaded by the browser.
var MainRouter = require('./2-mainRouter'); //A Backbone Router
//doc ready
$(function () {
router = new MainRouter();
"use strict";
// Domenic needs a Tweeter
function Domenic(tweeter) {
this.tweeter = tweeter;
}
Domenic.inject = ["tweeter"];
Domenic.prototype.doSomethingCool = function () {
return this.tweeter.tweet("Did something cool!");

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style