Skip to content

Instantly share code, notes, and snippets.

View marc-rutkowski's full-sized avatar

Marc Rutkowski marc-rutkowski

View GitHub Profile
@marc-rutkowski
marc-rutkowski / pasteAndFormatJSON.md
Last active February 4, 2021 11:40
Truc VScode : copier le contenu du clipboard dans un nouveau fichier et appliquer le formatage JSON

Truc VScode : copier le contenu du clipboard dans un nouveau fichier et appliquer le formatage JSON

Requiert les plugins multiCommand et changeLanguageMode.

A rajouter dans le fichier settings.json:

"multiCommand.commands": [
    {
 "command": "multiCommand.pasteAndFormatJSON",
@marc-rutkowski
marc-rutkowski / svg-transform.js
Created January 10, 2018 11:14
Custom Jest transformer for SVG files
/**
* Custom Jest transformer for SVG files
* Replace SVG file contents by a pseudo <svg /> JSX element containing only a data-filename attribute
*
* To make this work with Jest you need to update your Jest configuration with this:
* "transform": {
* "^.+\\.js$": "babel-jest",
* "^.+\\.svg$": "path/to/svg-transform.js"
* }
*
/**
* Custom PropTypes validator for Immutable JS data
*
* This helper performs the following operations
* 1. Check that prop is immutable
* 2. Convert value toJS() then check it against the prop type specs.
*/
import PropTypes from 'prop-types';
import { isImmutable } from 'immutable';
@marc-rutkowski
marc-rutkowski / README.md
Last active June 17, 2021 13:17
react-storybook with react-boilerplate (content of the .storybook/ directory)

react-storybook with react-boilerplate

Explains how to install and configure react-storybook into a project created from the react-boilerplate setup.

Intro

React-boilerplate (rbp) is a good starting point to create React apps, with a focus on performance, best practices and DX.

The community around the repository is amazing and a constant source of learning.

@marc-rutkowski
marc-rutkowski / func.js
Last active January 23, 2017 19:26
ES6 func
const isUnique = (value, index, self) => self.indexOf(value) === index;
const unique = items => items.filter(isUnique);
const mapBy = (items, key) => items.map(item => item[key]);
const uniqueKeys = (items, key) => unique(mapBy(items, key));
const someKeys = (item, keys) => keys.reduce((result, key) => {
result[key] = item[key];
return result;
}, {});