Skip to content

Instantly share code, notes, and snippets.

View gaelollivier's full-sized avatar

Gael Ollivier gaelollivier

  • Stripe
  • Los Angeles, CA
View GitHub Profile
@gaelollivier
gaelollivier / sagas-example.js
Created October 24, 2016 21:21
Examples of Snapshot testing a Redux Saga
/**
* Basic saga that revokes session and redirects to /login
* each time a LOGOUT action is dispatched
*/
function* logoutSaga() {
while (true) {
yield take(LOGOUT)
yield put(revokeSession())
yield put(redirect('/login'))
}
@gaelollivier
gaelollivier / ControlledRouter.js
Last active October 6, 2016 09:36 — forked from steida/Root.jsx
React Router v4 ControlledRouter
// @flow
import React, { Component } from 'react'
import BrowserHistory from 'react-history/BrowserHistory'
import { Push } from 'react-history'
import { StaticRouter } from 'react-router'
/**
* ControlledRouter, greatly inspired by https://gist.github.com/donnanicolas/3d76397a92551f449637590bf0413133
@gaelollivier
gaelollivier / index.html
Created June 7, 2016 16:03
Track mouse position (useful for e2e debugging, for example)
<div id="mouse" style="width:10px; height: 10px; background: red; position: absolute;"></div>
<script type="text/javascript">
setTimeout(function () {
var $ = jQuery;
$(document).mousemove(function (e) {
$('#mouse').css({ top: e.clientY + 1, left: e.clientX + 1});
});
}, 1000);
</script>