Skip to content

Instantly share code, notes, and snippets.

View emyann's full-sized avatar
🏠
Working from home

Yann RENAUDIN emyann

🏠
Working from home
View GitHub Profile
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.morphism=e():t.morphism=e()}(this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){retur
@emyann
emyann / StateMachine.ts
Created February 20, 2019 23:40
Jive State Machine
// XState https://statecharts.github.io/xstate-viz/
const lightMachine = Machine({
id: 'light2',
initial: 'standing',
states: {
standing: {
on: { startOutgoingCall: 'waitForAnswer' },
on: { startIncomingCall: 'ringing' }
// actionCreators.ts
import { Action } from 'redux';
import { ThunkAction } from 'redux-thunk';
import { AppState } from './rootReducer';
export type AppAction<A = Action, P = any> = A & { payload: P };
export function makeActionCreator<P, T extends string = string>(type: T) {
function actionCreator(payload?: P): AppAction<Action<typeof type>, P> {
return {
import { combineReducers } from 'redux';
import { default as calls } from '../calls/calls.reducer';
const rootReducer = combineReducers({
calls
});
export type AppState = ReturnType<typeof rootReducer>;
export default rootReducer;
import { CallEventsActions } from './callEvents.action';
export interface CallState {
latestCall: string | null;
byId: { [id: string]: Call };
allIds: string[];
}
export const CALLS_INITIAL_STATE = {
latestCall: null,
import { makeActionCreator } from '../actions/actionCreators';
import { Call } from '@jive/realtime-events';
export enum ActionsType {
START_INCOMING_CALL = 'callEvents/startIncomingCall',
START_INCOMING_CONVERSATION = 'callEvents/startIncomingConversation',
}
type ActionPayload = { call: Call }
import { Action } from 'redux';
import { ThunkAction } from 'redux-thunk';
import { AppState } from '../reducers';
export type AppAction<A = Action, P = any> = A & { payload: P };
export function makeActionCreator<P, T extends string = string>(type: T) {
function actionCreator(payload?: P): AppAction<Action<typeof type>, P> {
return {
type,
import Router from 'next/router';
import { format, resolve, parse } from 'url';
import Link from 'next/link';
import PropTypes, { exact } from 'prop-types';
import { execOnce, warn } from 'next/dist/lib/utils';
import { Component } from 'react';
export const prefetch = async href => {
// if we're running server side do nothing
if (typeof window === 'undefined') return;
@emyann
emyann / hyper.js
Last active October 13, 2018 23:56
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'canary',
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/yrenaudin/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes