Skip to content

Instantly share code, notes, and snippets.

View subtleGradient's full-sized avatar
👋

Tom Aylott subtleGradient

👋
View GitHub Profile
@subtleGradient
subtleGradient / hello.loo
Created June 25, 2024 03:00
Loose Lang Machine v0.2024.06.24 examples
#!/usr/bin/env lool
print Hello, World! or something like that
/* eslint-disable @typescript-eslint/no-unused-vars */
"use client"
import { Suspense, use, useMemo } from "react"
import { Text } from "react-native"
import { waitForTransactionReceipt } from "src/lib/viem"
import { PromisedValue } from "src/utils/type-helpers"
import { Address } from "viem"
type TransactionReceipt = PromisedValue<ReturnType<typeof waitForTransactionReceipt>>
@captbaritone
captbaritone / live-resolvers.md
Created September 20, 2023 05:07
Dropping Live Resolver Docs [Raw]

0. Relay Live Resolvers

Relay Liver Resolvers are an experimental Relay feature which lets you extend your server’s GraphQL schema to include additional client state. For example, you might want to expose data from a legacy state management solution or from IndexDB to your Relay components.

Your experience writing GraphQL resolvers on the server should mostly apply to writing Live Resolvers. The main distinction is that Live Resolvers are reactive. Instead of just reading a single values, Live Resolvers model a value that might change over time, similar to an observable.

Pages

@lmmx
lmmx / diarise.py
Last active November 7, 2023 21:37
Python commands to create speaker diarisation
# ffmpeg -i foo.m4a foo.wav
from pyannote.audio import Pipeline
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization")
diarization = pipeline("foo.wav")
# RTTM format https://catalog.ldc.upenn.edu/docs/LDC2004T12/RTTM-format-v13.pdf
with open("foo.rttm", "w") as rttm:
diarization.write_rttm(rttm)
@jonathantneal
jonathantneal / command.js
Last active October 26, 2022 07:20
Executable JavaScript Modules
":" //#;exec /usr/bin/env node --input-type=module - $@<$0
import process from 'process'
const { argv } = process
console.log(argv)
@damc-dev
damc-dev / GetZoomParticipants.scpt
Last active March 8, 2024 15:13
Applescript to Retrieve Participants From Zoom MacOS App
#!/usr/bin/osascript
on convertListToString(theList, theDelimiter)
set AppleScript's text item delimiters to theDelimiter
set theString to theList as string
set AppleScript's text item delimiters to ""
return theString
end convertListToString
on get_participants()
@skovhus
skovhus / flow-to-typescript-codemod.sh
Last active May 26, 2022 16:27
Quick and dirty flow-to-typscript migration codemod
#!/bin/sh
#
# This is a super quick and dirty codemod for migration a codebase from Flow to TypeScript.
#
# Step 1:
# npm i -g jscodeshift
# Step 2: rename all .js files to .ts(x)
# find src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
# find storybook -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
# find src/**/components -name "*.ts" -exec sh -c 'mv "$0" "${0%.ts}.tsx"' {} \;
@derek-duncan
derek-duncan / [email protected]
Last active January 26, 2019 18:56
React 16.7.0-alpha.0 Typescript Types for Hooks
// put me in your global.d.ts file
declare module 'react' {
/**
* Returns a stateful value, and a function to update it.
*/
function useState<TValue>(
initialState: TValue | (() => TValue)
): [TValue, (value: TValue | ((prevValue: TValue) => TValue)) => void];
@caseywatts
caseywatts / jscodeshift.md
Last active January 31, 2020 10:21
Sharing jscodeshift codemods

codemod-cli is straightforward - but it's especially made for codemod projects that have multiple transforms. For a single transform, we could/should have a simpler interface for consumers.

Here are three ways to share your codemod with others. The npx methods require you npm publish the repo.

Method 1 - global install, using githubusercontent

Easiest method for the developer, especially if you only have one transform and/or if you're not using codemod-cli. This uses the github-hosted raw.githubusercontent link to run it, kinda like running it from a gist. Here's an example using ember-mocha-codemods.

npm install -g jscodeshift
@souporserious
souporserious / getJSONFromFigmaFile.js
Created July 13, 2018 21:52
Generates JSON from Figma file
import request from 'request'
const api_endpoint = 'https://api.figma.com/v1'
const personal_access_token = 'FIGMA_ACCESS_TOKEN_HERE' // https://www.figma.com/developers/docs#auth-dev-token
function downloadSvgFromAWS(url) {
return new Promise((resolve, reject) => {
request.get(
url,
{