Skip to content

Instantly share code, notes, and snippets.

View tlvenn's full-sized avatar

Christian Meunier tlvenn

View GitHub Profile
@sibelius
sibelius / ErrorBoundaryWithRetry.tsx
Created September 19, 2019 22:19
ErrorBoundaryWithRetry to be used with relay useQuery hook
class ErrorBoundaryWithRetry extends React.Component<Props, State> {
state = {error: null};
static getDerivedStateFromError(error): State {
return {error: error};
}
_retry = () => {
this.setState({error: null});
}
@sibelius
sibelius / FormUseFormik.tsx
Last active April 13, 2023 20:09
Example showing how to useFormik and FormikProvider
type Props = {
};
const FormUseFormik = (props: Props) => {
const { enqueueSnackbar } = useSnackbar();
const onSubmit = (values) => {
enqueueSnackbar(`submit: ${JSON.stringify(values)}`, {
preventDuplicate: true,
persist: false,
});
@nicbet
nicbet / Dockerfile
Created June 27, 2019 03:00
Elixir 1.9 Releases Alpine Linux Docker Multi-Stage Build
# ---- Build Stage ----
FROM erlang:22-alpine AS app_builder
# Set environment variables for building the application
ENV MIX_ENV=prod \
TEST=1 \
LANG=C.UTF-8
# Fetch the latest version of Elixir (once the 1.9 docker image is available you won't have to do this)
RUN set -xe \
@shahidv3
shahidv3 / harbor_tags_delete.sh
Last active February 7, 2021 07:56
Shell script to remove docker container files from Harbor
#!/bin/bash
## ##############################################################################################################################
## Author : Sahid Shaik shahids89@gmail.com #
## Usage: ./tags_delete.sh #
## Harbor images deletion is 2 step process #
## 1. Soft delete image using this script #
## 2. Run garbage collector #
## ##############################################################################################################################
@janeczku
janeczku / rke-etcd-secret-data-encryption.md
Created April 2, 2019 14:32
Rancher RKE etcd secrete data encryption
const DISK_CACHE_ENABLED = true;
const ONE_DAY = 24 * 60 * 60 * 1000;
const MAX_STORE_SIZE = 1 * 1024 * 1024; // 1mb, TODO: figure out how big this can be.
const RELAY_STORE_KEY = 'relay_store';
const RELAY_STORE_META_KEY = 'relay_store_meta';
const DEFAULT_META = {
lastGC: Date.now(),
environment: getConfig().environment,
appVersion: Device.version(),
};
@sibelius
sibelius / xcode10_fix.sh
Created November 4, 2018 19:33
fix third-party problem on react native
#!/usr/bin/env bash
cd node_modules/react-native
./scripts/ios-install-third-party.sh
cd third-party/glog-0.3.5/
../../scripts/ios-configure-glog.sh
@aweary
aweary / App.js
Last active August 29, 2021 14:06
import React from "react";
import useMutableReducer from "./useMutableReducer";
const reducer = (draft, action, state) => {
switch (action) {
case "increment":
draft.count++;
break;
case "decrement":
draft.count--;
@tazjin
tazjin / thoughts.md
Last active February 28, 2024 12:05
Nix builder for Kubernetes
@sebastien
sebastien / nix-fishgen.py
Last active May 31, 2021 02:52
Python script that converts Nix's profile bash script to Fish
#!/usr/bin/env python3
# Updated: 2018-10-17
import re, sys, os
"""
Converts the Nix profile SH script to a Fish-compatible profile using a
simple line-by-line replace algorithm.
"""