Skip to content

Instantly share code, notes, and snippets.

@andyjessop
andyjessop / prompt.txt
Created April 20, 2024 07:43
A prompt to categorise and analyse sentiment for GitHub issues
Please analyze the following GitHub issue data, which is provided as a JSON object:
{
"title": "🐛 BUG: WebSocket typing doesn't work in apps that also pull in DOM types",
"body": "Which Cloudflare product(s) does this pertain to?",
}
Provide a response with the following structure:
<json>
@KristofferEriksson
KristofferEriksson / useLocation.ts
Created February 11, 2024 16:44
A React Typescript hook that provides real-time geolocation data, complete with heading and speed metrics
import { useEffect, useState } from "react";
interface LocationOptions {
enableHighAccuracy?: boolean;
timeout?: number;
maximumAge?: number;
}
interface LocationState {
coords: {
@natew
natew / AnimatedNumbers.tsx
Last active March 8, 2024 00:27
AnimatePresence number ticker
const AnimatedNumbers = () => {
const [numbers, setNumbers] = useState(100_000)
const len = `${numbers}`.length
return (
<YStack gap="$5">
<XStack gap="$2">
<Button
onPress={() => {
import React from 'react';
import {View, SafeAreaView, ScrollView} from 'react-native';
import {MotiView} from 'moti';
const MotiPlaceholders = () => {
const gray = '#505050';
const lightGray = '#a0a0a0';
const animationDuration = 700;
return (
@pzatorski
pzatorski / react-native-setup-ios.sh
Created May 7, 2022 20:03
Clean a React Native project (iOS)
#!/bin/bash
# exit when any command fails
set -e
COMMAND=$1
function clean() {
printf "🧹 Cleaning.. \n"
rm -rf ~/Library/Caches/CocoaPods Pods ~/Library/Developer/Xcode/DerivedData
@SimeonGriggs
SimeonGriggs / wordle.js
Last active February 11, 2022 09:54
Sanity Schema for Wordle
import React from 'react'
import {withDocument} from 'part:@sanity/form-builder'
import {Stack, Card, Flex, Text} from '@sanity/ui'
import {format} from 'date-fns'
const WORD_LENGTH = 5
function Guess({char, answer, index}) {
const answerSplit = answer.split('')
let tone = `default`
@kelset
kelset / 2018-2022 RN retrospective.md
Last active July 26, 2022 05:11
A personal retrospective of being a maintainer for React Native for the past 4 years.

4 years as a React Native OSS maintainer: a retrospective

Why writing this, and why now? In January 2018 I started my journey as a maintainer of the React Native (RN) open source repo — it is the longest role I’ve ever kept going in my professional career, in a way — and I think now, at the 4 years mark, it is a very good time for me to pause, and force myself to think about how things have changed since then.

How did I become a maintainer? After a big burnout with react-navigation that led me to learn how to correctly interact with Open Source Software (OSS), I was starting to interact with OSS again by being a good citizen in the RN repository. Seeing me constantly in the issue section, trying to help out, led some Facebook (FB) engineers to decide to ask me to join the OSS repo with write access, so that I could be more proactive in helping its maintenance… and here we are.

Even so, I was never an em

@intergalacticspacehighway
intergalacticspacehighway / PinchToZoom.tsx
Last active April 23, 2024 20:16
Pinch to zoom reanimated + gesture handler
import React, { useMemo, useState } from "react";
import { LayoutChangeEvent, StyleSheet } from "react-native";
import {
PinchGestureHandler,
PinchGestureHandlerGestureEvent,
} from "react-native-gesture-handler";
import Animated, {
useAnimatedGestureHandler,
useAnimatedStyle,
useSharedValue,
@h4de5
h4de5 / _toshiba-api.php
Last active October 16, 2023 19:45
Toshiba AC API Client - Get status and settings from Toshiba AC Services (used e.g. in RAS-18PKVSG-E + RAS-18PAVSG-E + WIFI Adapter RB-N103S-G)
#!/usr/local/bin/php73
<?php
$username = "YOUR_USERNAME";
$password = "YOUR_PASSWORD";
/**
* @param string $url
* @param string $post
* @param string $token