Skip to content

Instantly share code, notes, and snippets.

View lionelB's full-sized avatar
🪂
Working from home

Lionel lionelB

🪂
Working from home
View GitHub Profile
@lionelB
lionelB / index.html
Created December 7, 2017 15:56
Pausable Timer // source http://jsbin.com/kavomij
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Pausable Timer</title>
<script src="https://unpkg.com/@reactivex/rxjs@5.1.1/dist/global/Rx.js"></script>
</head>
<body>
<button class="start5">start 5</button>
@lionelB
lionelB / index.html
Created December 7, 2017 15:54
Pausable Timer // source http://jsbin.com/kavomij
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Pausable Timer</title>
<script src="https://unpkg.com/@reactivex/rxjs@5.1.1/dist/global/Rx.js"></script>
</head>
<body>
<button class="start5">start 5</button>
@lionelB
lionelB / compose.js
Created May 1, 2017 13:21 — forked from WaldoJeffers/compose.js
JavaScript one-line compose (ES6)
const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args)))
// Usage : compose functions right to left
// compose(minus8, add10, multiply10)(4) === 42
//
// The resulting function can accept as many arguments as the first function does
// compose(add2, multiply)(4, 10) === 42
@lionelB
lionelB / README.md
Created January 16, 2017 10:01 — forked from rgrove/README.md
Cake's approach to React Router server rendering w/code splitting and Redux

Can't share the complete code because the app's closed source and still in stealth mode, but here's how I'm using React Router and Redux in a large app with server rendering and code splitting on routes.

Server

  1. Wildcard Express route configures a Redux store for each request and makes an addReducers() callback available to the getComponents() method of each React Router route. Each route is responsible for adding any Redux reducers it needs when it's loaded. (This isn't really necessary on the
@lionelB
lionelB / Stylable.js
Created October 23, 2016 12:32 — forked from MoOx/Stylable.js
Stylable component that works well with React inline styles
// @flow
import React from "react"
import Hoverable from "../../modules/Hoverable"
import Focusable from "../../modules/Focusable"
import Touchable from "../../modules/Touchable"
type PropsType = {
children?: React$Element<any>,

Keybase proof

I hereby claim:

  • I am lionelb on github.
  • I am lionelb (https://keybase.io/lionelb) on keybase.
  • I have a public key whose fingerprint is D8AD DDE8 5CB3 BDA7 6D45 E493 5238 75D0 D51D 1CD5

To claim this, I am signing this object:

@lionelB
lionelB / GoogleMap.js
Created August 10, 2016 20:41 — forked from cedricdelpoux/GoogleMap.js
React Google Map
import React, {Component, PropTypes} from "react"
import placesLoader from "./placesLoader"
import placesShape from "./placesShape"
import styles from "./GoogleMap.css"
import iconMarker from "./iconMarker.png"
import iconTrash from "./iconTrash.png"
const {arrayOf, func, number, shape, string} = PropTypes
@lionelB
lionelB / dispatcher.js
Created June 28, 2016 12:38
a small event dispatcher based on es6 Map/Set
const dispatcher = () => {
const eventMap = new Map()
const getHandlers = (name) => {
if ( !handlers.has(name)) {
handlers.set(name, new Set())
}
return eventMap.get(name)
}
const on = ({name, fn}) => {
@lionelB
lionelB / transform.js
Last active January 19, 2016 13:52
markdown + gray-matter file transformation
var markdownit = require("markdown-it")("commonmark");
var yamlParser = require("gray-matter");
var fs = require("fs");
var path = require("path");
var content = fs.readFileSync(path.join(__dirname, "md/index.md"));
var yaml = yamlParser(content.toString());
console.log(markdownit.render(yaml.content));
@lionelB
lionelB / cordova-tips.md
Created January 6, 2016 13:03 — forked from revolunet/cordova-tips.md
Cordova iOS tips

General

  • create a single page javascript application
  • be as low-level as possible to be able to control performance (=minimize layers)
  • masterize your dev/build environnement so you can work/play nicely

Debug apps

  • Open safari console in development menu with simulator or attached devices (enable debug in ipad/safari dev options)
  • debug your app from xcode to get native debugger and performance metrics