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
@emyann
emyann / singleton.es6.js
Created January 17, 2018 19:26
ES6 Singleton
class ImmutableClass {
constructor() {
// return value from class constructor
return createInstance()
}
}
let instance = null;
function createInstance() {
@emyann
emyann / Icon.js
Last active September 28, 2018 19:39
MDI Icon support in React with Webpack
import { PureComponent, Component } from 'react'
import SVGInline from 'react-svg-inline'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import AppIcons from '../../../static/icons/app-icons.json'
const IconSVGContainer = styled.span`
display: inline-flex;
`
const IconSVG = styled(SVGInline)`
function monitoredScope(fn: Function, ...args: any[]) {
const startTime = performance.now();
const result = fn.call(this, ...args);
const endTime = performance.now();
const elapsedTime = Math.round((endTime - startTime) * 1000) / 1000;
return { data: result, infos: { startTime, endTime, elapsedTime } };
}
const glob = require('glob');
const util = require('util');
const fs = require('fs');
const path = require('path');
// icons.js
const icons= [
'account',
'plus'
];
# 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
@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',
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;
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 { 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 { CallEventsActions } from './callEvents.action';
export interface CallState {
latestCall: string | null;
byId: { [id: string]: Call };
allIds: string[];
}
export const CALLS_INITIAL_STATE = {
latestCall: null,