Skip to content

Instantly share code, notes, and snippets.

@jckw
jckw / PrimitiveMasonry.tsx
Created December 30, 2021 17:49
Naive approach to Masonry layout in React with CSS Grid
import React from 'react'
interface Props {
colCount: number
gap: number
children: React.ReactNode[]
}
const PrimitiveMasonry: React.FC<Props> = ({
colCount = 2,
@jckw
jckw / $addr.tsx
Created December 26, 2021 21:08
Display NFTs for a Tezos wallet with Remix.
import { json, LoaderFunction, useCatch, useLoaderData } from 'remix'
type BCDBalance = {
contract: string
token_id: number
name: string
description: string
artifact_uri: string
display_uri: string
thumbnail_uri: string
@jckw
jckw / uuid_rename.py
Created December 22, 2021 14:51
Rename simple files to UUID names. Useful for renaming folders of photos for slideshows.
import pathlib
import os
import uuid
if __name__ == "main":
files = os.listdir()
for f in files:
suffix = pathlib.Path(f).suffix
@jckw
jckw / roam_to_obsidian.py
Created November 14, 2021 10:56
Rename Roam daily notes to Obsidian format.
import os
import dateutil
import glob
# Assumes you're working in a directory with only the Daily Notes
# Files that aren't parseable dates will fail
files = map(lambda n: n[2:-2], glob.glob("./*.md"))
for f in files:
d = dateutil.parser.parse(f)
@jckw
jckw / testflight.yml
Created November 9, 2021 21:05
A simple Github Actions workflow for releasing TestFlight builds with Fastlane.
name: Release to TestFlight internally and bump build number
on: [workflow_dispatch]
jobs:
internal_testflight:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
# We use a deploy key (i.e. public key) in the Houston-App/certificates repo to
@jckw
jckw / Card.tsx
Last active November 3, 2021 21:31
Super simple Tinder-style swipeable Card component with Reanimated 2
import { Text } from "react-native"
import React from "react"
import { PanGestureHandler } from "react-native-gesture-handler"
import Animated, {
runOnJS,
useAnimatedGestureHandler,
useAnimatedStyle,
useSharedValue,
withSpring,
} from "react-native-reanimated"
@jckw
jckw / Stack.tsx
Created October 25, 2021 20:39
Stitches Stack component for Figma-style positioning.
import { styled } from "@stitches/react"
const Stack = styled("div", {
display: "flex",
variants: {
dir: {
col: { flexDirection: "column" },
row: { flexDirection: "row" },
},
@jckw
jckw / cloudSettings
Last active February 28, 2022 19:08
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-07-12T19:49:30.768Z","extensionVersion":"v3.4.3"}
@jckw
jckw / useConnection.js
Created June 3, 2020 12:00 — forked from jedwards1211/useConnection.js
useConnection (a React hook for infinite scrolling with Apollo, Relay-style Connections, and react-virtualized)
/**
* @flow
* @prettier
*/
import { type QueryRenderProps } from 'react-apollo'
import * as React from 'react'
import {
get,
takeRightWhile,
import React from "react"
import { Image } from "react-native"
const sources = [
{
height: 16,
uri:
"https://finimize-img-test.imgix.net/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1498671546682-94a232c26d17%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D987%26q%3D80?fit=crop&h=16&ixlib=python-3.0.0&w=16&s=60604503c09cf60a0a360046429a8fc0",
width: 16
},