Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Freelance React / React Native Expert, Cross-platform fanboy (native, web...)

Max Thirouin MoOx

:shipit:
Freelance React / React Native Expert, Cross-platform fanboy (native, web...)
View GitHub Profile
View reset-button.css
%reset-Button {
border: none;
margin: 0;
padding: 0;
width: auto;
overflow: visible;
background: transparent;
/* inherit font & color from ancestor */
@MoOx
MoOx / index.js
Last active Apr 11, 2021
Export/import github labels
View index.js
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
@MoOx
MoOx / README.md
Last active Mar 19, 2021
How to keep in sync your Git repos on GitHub, GitLab & Bitbucket easily
@MoOx
MoOx / comments-trick.json
Last active Mar 8, 2021
How to make comment in JSON file
View comments-trick.json
{
"//field": "These 'double quote' 'double quote' are used as comments, because JSON doesnt' allow comment",
"field": {},
"#another-field": "Another comment",
"another-field": {},
"/*stuff": "Be careful to use them when you have full control of the content :)",
"stuff": [],
"bla": "bla"
}
@MoOx
MoOx / README.md
Last active Dec 3, 2020
frontend project Readme example
View README.md

PROJECT BLAH BLAH

Requirements

For development, you will only need Node.js installed on your environement. And please use the appropriate Editorconfig plugin for your Editor (not mandatory).

Node

Node is really easy to install & now include NPM.

@MoOx
MoOx / package.json.js
Last active Nov 20, 2020
Boost your Webpack performance with DLLPlugin (will bundle as dll all your "dependencies", see comment in package.json)
View package.json.js
{
"private": true,
// ...
"#dependencies": "dependencies are the one shipped to the client",
"dependencies": {
"babel-polyfill": "^6.7.4",
"react": "^15.0.0",
// ...
"whatwg-fetch": "^0.11.1"
},
@MoOx
MoOx / isDblTouchTap.js
Last active Sep 23, 2020
Double touch tap workaround for React based on onTouchTap (react-tap-event-plugin)
View isDblTouchTap.js
const dblTouchTapMaxDelay = 300
let latestTouchTap = {
time: 0,
target: null,
}
export default function isDblTouchTap(event) {
const touchTap = {
time: new Date().getTime(),
target: event.currentTarget,
@MoOx
MoOx / createElement.js
Last active May 21, 2020
A tiny helper for document.createElement.
View createElement.js
module.exports = function(options) {
var el
, a
, i
if (!options.tagName) {
el = document.createDocumentFragment()
}
else {
el = document.createElement(options.tagName)
if (options.className) {
@MoOx
MoOx / cancelable-promise.js
Created Aug 5, 2016
Way to have cancelable promise
View cancelable-promise.js
// @flow
// https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html
export type CancelablePromise = {
promise: Promise<any>,
cancel: Function,
}
export const makeCancelablePromise = (