Skip to content

Instantly share code, notes, and snippets.

View iammerrick's full-sized avatar

Merrick Christensen iammerrick

View GitHub Profile
@iammerrick
iammerrick / app.js
Created July 25, 2019 06:24
Coordinate character states with state machines allowing for async transitions.
const app = new PIXI.Application({ transparent: true });
const { Machine, interpret, send, sendParent, assign } = window.XState;
document.body.appendChild(app.view);
// Invoked child machine
const CharacterMachine = a => {
return Machine({
id: "Kolohe",
initial: "active",
console.log("Linked From Head");
console.log('Loaded by a url!');
@iammerrick
iammerrick / spy.js
Last active January 11, 2019 06:24
Determine if a user called "then" on registration promise.
const spyInstance = (on, replace, spy) => {
const _real = on[replace];
on[replace] = function(...args) {
const ret = _real.apply(this, args);
const newRet = spy(args, ret, this);
if (newRet) return newRet;
return ret;
};
};
requestIdleCallback(function tick() {
requestIdleCallback(tick);
});
@iammerrick
iammerrick / PanGesture.js
Last active August 31, 2018 16:42
Panning Mobile Web
import React from 'react';
import ReactDOM from 'react-dom';
import { getPointRelativeToElement, getDistanceBetweenPoints } from 'utilities/geometry';
const THRESHOLD = 10;
const pointFromTouch = (touch) => ({ x: touch.clientX, y: touch.clientY });
class PanGesture extends React.Component {
constructor() {
set nocompatible
call plug#begin('~/.vim/plugged')
Plug 'chriskempson/base16-vim'
Plug 'tpope/vim-surround'
Plug 'scrooloose/nerdtree'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'pangloss/vim-javascript'
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --tern-completer' }
Plug 'SirVer/ultisnips'
@iammerrick
iammerrick / NestedRoutes.js
Created February 23, 2017 17:57
React Router 4 is fundamentally different because it allows for nested routes that rely on parent context. This facilitates recursive routes and other B-E-A-UTIFUL things.
import React from 'react'
import {
BrowserRouter as Router,
Route,
Link
} from 'react-router-dom'
const BasicExample = () => (
<Router>
<div>
import React, { Component } from 'react';
import {List, CellMeasurer} from 'react-virtualized';
import moment from 'moment';
const days = 3000;
const today = days / 2;
const daysToShow = 3;
const height = 180;
const rowRenderer = ({
You will receive {numberOfTexts, plural,
=0 {no more texts.}
=1 {{duration, plural,
=0 {1 more text.}
=1 {1 text tomorrow.}
other {1 text within # days.}
}}
other {{duration, plural,
=0 {{numberOfTexts} more texts.}
=1 {{numberOfTexts} texts tomorrow.}