Skip to content

Instantly share code, notes, and snippets.

View slorber's full-sized avatar
🏠
Working from home

Sébastien Lorber slorber

🏠
Working from home
View GitHub Profile
@slorber
slorber / test themed image.md
Created May 25, 2022 15:55
test themed image
Shows an illustrated sun in light color mode and a moon with stars in dark color mode.
@slorber
slorber / sponsor-this-week-in-react.md
Last active August 31, 2022 17:00
Sponsor This Week In React
@slorber
slorber / generate-docs-from-js.js
Last active April 2, 2024 19:37 — forked from arinthros/generate-docs-from-js
Generate Docusaurus Docs from JSDoc
/**
* Requires jsdoc and jsdoc-to-markdown
*/
/* eslint-disable no-console */
const fs = require('fs')
const path = require('path')
const glob = require('glob')
const { execSync } = require('child_process')
const jsdoc2md = require('jsdoc-to-markdown')
@slorber
slorber / README.md
Last active January 18, 2023 09:48
React Hebdo 2020

Je teste un système de "petites annonces". Le même Gist sera utilisé sur plusieurs éditions.

Mettez un commentaire:

  • si vous recrutez
  • si vous cherchez un travail ou une mission
  • pour commenter un article
  • pour donner votre avis sur la newsletter
export const intersperse = <T>(arr: T[], separator: (n: number) => T): T[] =>
arr.flatMap(arr, (a, i) => i > 0 ? [separator(i-1), a] : [a]))
@slorber
slorber / react-navigation-tree.jsx
Last active August 13, 2022 19:17
react-navigation-tree.jsx
const App = createAppContainer(
createStack({
LoggedSwitch: createSwitch({
// When user is authenticated
LoggedIn: createStack({
// The logged in root is generally a tab or drawer navigator
LoggedInRoot: createTabsOrDrawer({
import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import useConstant from 'use-constant';
import produce from 'immer';
import { useIsMountedFn } from './useIsMounted';
@slorber
slorber / ElementContainer.js
Created September 20, 2018 11:56
ElementContainer.js
import React from 'react';
const generateHolderKey = (() => {
let counter = 0;
return () => {
counter += 1;
return `holder_${counter}`;
};
})();
const setupAppOverTheAirUpdates = () => {
const checkForUpdates = async () => {
if (__DEV__) {
console.debug('checkForUpdates disabled in DEV');
return;
}
try {
const update = await Updates.checkForUpdateAsync();
console.debug('checkForUpdates result', update);
if (update.isAvailable) {