Skip to content

Instantly share code, notes, and snippets.

View themouette's full-sized avatar
🍎

Julien MUETTON themouette

🍎
View GitHub Profile
@themouette
themouette / 1. eslint and prettier.markdown
Last active April 1, 2022 21:56
Having eslint and prettier to work together

It requires:

  • eslint-config-prettier to avoid collision with other eslint rules
  • eslint-plugin-prettier to add the eslint rules
  • prettier package

Install

yarn add --dev eslint-config-prettier eslint-plugin-prettier prettier
@themouette
themouette / git_commands.sh
Last active May 26, 2020 14:32
check git branches status
# Find common ancestor of 2 branches:
git rev-parse BRANCH1 BRANCH2
# Last commit date (relative time) on BRANCH
git --no-pager for-each-ref BRANCH --format='%(committerdate:relative)'
# Last commit date on BRANCH
git --no-pager show --format='%ai'
# Last commit author on BRANCH
git --no-pager show --format='%an'
export const whyIsItRecalculating = (
funcName,
...fieldNames
) => decoratedFunc => {
let prevValues;
return (...values) => {
// eslint-disable-next-line no-console
console.group(`whyIsItRecalculating ${funcName}`);
if (prevValues) {
if (prevValues.length < values.length) {
@themouette
themouette / app.jsx
Last active March 20, 2018 12:45
react context
import React, { Fragment, Component, createContext } from 'react';
import ReactDOM from 'react-dom';
const ThemeContext = createContext('light');
const ThemedItem = props => (
<ThemeContext.Consumer>{
(theme) => <p>{theme}</p>
}</ThemeContext.Consumer>
@themouette
themouette / install-irc-boucer.rst
Created January 12, 2017 16:51
Install an irc bouncer

IRC is cool, but IRC is volatile. Here is how to install [ZNC](http://wiki.znc.in) on an LXC machine.

> Note that irssi/weechat/whateverircclient in a screen/tmux would do as > well

First, ask for a LXC container to [snoc@gandi.net](mailto:snoc@gandi.net).

Once you get your container, follow those steps:

#!/bin/bash
BRANCH="$1"
ORIGINAL_BRANCH="develop"
if [[ -z "${BRANCH}" ]]; then
echo "You must provide a branch as first argument"
echo ""
echo " $0 features/develop/new-sidebars"
exit 1;
fi
@themouette
themouette / bin-test.js
Created July 24, 2015 15:47
mocha test launcher
#!/usr/bin/env iojs
var lookupDirs = ['app/shared/lib', 'app/shared'];
var resolveModuleSource = require('../babel-hooks');
require('babel/register')({
stage: 0,
resolveModuleSource: resolveModuleSource(lookupDirs)
});
var fs = require('fs');
### Keybase proof
I hereby claim:
* I am themouette on github.
* I am themouette (https://keybase.io/themouette) on keybase.
* I have a public key whose fingerprint is 7367 4DE9 B737 D321 8FEC 6860 0FE9 A9C6 0ED6 5AFD
To claim this, I am signing this object:
@themouette
themouette / babel-hook.js
Created June 29, 2015 22:56
babel hook to load modules from several directories
/**
* Hook babel compilation into require.
*
* To disable cache, see https://babeljs.io/docs/usage/require/#environment-variables
*
* ``` javascript
* const lookupDirs = ['app/server', 'app/shared/lib', 'app/shared'];
* const resolveModuleSource = require('babel-hooks');
*
* require('babel/register')({
@themouette
themouette / actionsTestUtils.js
Last active August 29, 2015 14:22
Flummox actions testutils
/**
* Simple actions test utils.
*
* This is definitely not the best api, but this is simple.
*
* FIXME override action `_dispatch` and `_dispatchAsync` to remove warning
* FIXME and to deliver a cleaner api
*/
import _ from 'lodash';