Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Noitidart / useRadio.ts
Created Apr 8, 2022
maybe useful maybe not. i made but never used it.
View useRadio.ts
import { useMemo, useRef } from 'react';
import { useMemoizedFn } from 'ahooks';
import { noop } from 'lodash';
type UseRadioInputs = {
// Defaults to undefined
defaultValue?: any;
onChange?: (value: any) => void;
View DetoxExpo.js
1. yarn add --dev detox jest-circus
2. detox init -r jest (This creates the e2e folder along with the .detoxrc.json)
3. yarn add --dev eslint-plugin-detox (optional)
plugins: [...'detox'...],
- Add this to your eslint config plugins
4.Make sure your your **eas.json** has a simulator build set up that looks like this then create a simulator release build by running: **eas build --profile simulator --platform ios**
"simulator": {
"ios": {
"simulator": true,
View postgres-notes.md
View _ff-addon-snippet-macIdleTime.js
Cu.import('resource://gre/modules/ctypes.jsm');
const cg = ctypes.open('/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics');
const CFTimeInterval = ctypes.double;
const CGEventSourceStateID = ctypes.uint32_t;
const CGEventType = ctypes.uint32_t;
const kCGEventSourceStateCombinedSessionState = 0;
const kCGAnyInputEventType = 0xFFFFFFFF;
View modal-context.js
import React, {
Children,
createContext,
useContext,
useEffect,
useRef,
useState
} from 'react';
import {
View withHookedInput.js
import React, { useCallback, useEffect, useRef } from 'react';import { defaults, omit, pick } from 'lodash';
import { useController, UseControllerProps } from 'react-hook-form';
import { TextInput, TextInputProps } from 'react-native';import { HookedInputTransformer } from 'src/lib/react-hook-form-transforms';interface HookedTextInputProps
extends Omit<TextInputProps, 'defaultValue'>,
UseControllerProps {
transform?: HookedInputTransformer;
}export default function withHookedInput(
ControlledInputComponent: typeof TextInput
) {
function HookedInput({ transform, ...props }: HookedTextInputProps) {
@Noitidart
Noitidart / HookedTextInput.js
Created May 12, 2021
Non-re-rendering react-hook-form TextInput component for react-native.
View HookedTextInput.js
import * as React from 'react';
import { Text, View, StyleSheet, TextInput, Button, Alert } from 'react-native';
import { useForm, useController } from 'react-hook-form';
import Constants from 'expo-constants';
import { pick, omit, defaults } from 'lodash';
const REQUIRED = { required: true };
function ClassicHookedTextInput(props) {
const controllerProps = defaults(
View bulletList-template-tag.js
var { stripIndents } = require("common-tags")
const toTitle = ad => ad.title;
const ads = [{ title: 'a' }, { title: 'b' }];
function bulletLists(strs, ...lists) {
return strs.reduce((compiled, str, ix) => {
compiled.push(str);
const list = lists[ix];
if (list) {
@Noitidart
Noitidart / tma-backend-framework.md
Last active Mar 29, 2021
The next backend framework to pick for TMA
View tma-backend-framework.md
  • Typescript
  • Output payload type for each status code of endpoint
  • Multi-roles per endpoint
  • Permissions per endpoint (base permissions provided by role, then extra permissions available)
  • Categorize endpoints by roles
  • Complete Datadog tracing
  • Response of JSON endpoints into datadog (i currently can't see 400 messages for what problems in the fields)
  • Log JSON response from endpoints
  • ORM nested populate
  • ORM find by nested populate critiera