Skip to content

Instantly share code, notes, and snippets.

@rsms
rsms / macos-distribution.md
Last active June 7, 2024 05:59
macOS distribution — code signing, notarization, quarantine, distribution vehicles
@mrousavy
mrousavy / MEMOIZE.md
Last active May 27, 2024 21:19
Memoize!!! 💾 - a react (native) performance guide
In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and  
returning the cached result when the same
inputs occur again.                                         
                                                     — wikipedia
@threepointone
threepointone / iframe.tsx
Created December 8, 2020 00:16
An iframe loader powered by Suspense
import { Suspense, useLayoutEffect, useRef, useState } from 'react';
type IFrameProps = React.ComponentPropsWithRef<'iframe'> & {
fallback?: JSX.Element;
};
export function IFrame(props: IFrameProps) {
const { fallback, ...rest } = props;
return (
import {
Dimensions,
LayoutChangeEvent,
Platform,
ScrollEvent,
ScrollView,
StyleSheet,
View,
} from "react-native";
import {Font, Space} from "../atoms";
@sibelius
sibelius / usePrompt.tsx
Last active October 27, 2022 19:05
Prompt user before leaving route or reload
import { useEffect, useRef } from 'react';
import { useHistory } from 'react-router-dom';
export const usePrompt = (when: boolean, message: string = 'Are you sure you want to quit without saving your changes?') => {
const history = useHistory();
const self = useRef(null);
const onWindowOrTabClose = event => {
if (!when) {
@elsangedy
elsangedy / component.js
Last active November 18, 2020 18:52
i18next
import React from 'react'
import { useT } from './hook.js'
const Comp = () => {
const { t, tDate, tTime, tDateTime, tCurrency } = useT()
const myDate = '1993-05-07T17:30:00z'
const myCurrency = 100