This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use client' | |
import {graphql} from 'react-relay' | |
import graphqlQuery, { | |
AllSecuritiesPageQuery | |
} from '~/__generated__/AllSecuritiesPageQuery.graphql' | |
import {createRelayHydrator} from '~/lib/relay/create-relay-hydrator' | |
export const {useHydratedPreloadedQuery, Hydrator} = | |
createRelayHydrator<AllSecuritiesPageQuery>(graphqlQuery) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This proxy is only used for e2e | |
const proxy = require('express-http-proxy'); | |
const express = require('express'); | |
// const { parse } = require('url'); | |
// const dev = process.env.NODE_ENV !== 'production'; | |
// const handle = app.getRequestHandler(); | |
const port = parseInt(process.env.PORT || 5900, 10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Record with timer: | |
ffmpeg -f avfoundation -s 1280x720 -i "1:0" -vf "drawtext=fontfile=/Users/hanford/Hellix-Black.otf:text='%{pts\:gmtime\:0\:%M\\\\\:%S}':fontcolor=white@1:borderw=8:bordercolor=black:x=w-tw-192:y=h-th-192:fontsize=230" no-bun-startup.mkv | |
crop video in two (left/right) parts: | |
ffmpeg -i bun-page.mp4 -filter_complex "[0]crop=iw/2:ih:0:0[left];[0]crop=iw/2:ih:ow:0[right]" -map "[left]" left.mp4 -map "[right]" right.mp4 | |
Convert video from mkv to mp4 | |
ffmpeg -i np-page.mkv -pix_fmt yuv420p np-page.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { promises } from "fs"; | |
import crypto from "crypto"; | |
import path from "path"; | |
import { print, parse } from "graphql"; | |
const plugin = { | |
name: "relay", | |
setup: build => { | |
build.onLoad({ filter: /\.tsx$/, namespace: "" }, async args => { | |
let contents = await promises.readFile(args.path, "utf8"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key}) | |
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=> | |
// arrays | |
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])): | |
// components | |
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=> | |
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):( | |
// create notes | |
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)), | |
// diff props |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Combine | |
enum APIError: Error, LocalizedError { | |
case unknown, apiError(reason: String) | |
var errorDescription: String? { | |
switch self { | |
case .unknown: | |
return "Unknown error" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"useState()": { | |
"prefix": "us", | |
"scope": "javascript,javascriptreact,typescript,typescriptreact", | |
"body": [ | |
"const [${1}, set${1/(.*)/${1:/capitalize}/}] = useState($2);", | |
"$0" | |
], | |
"description": "React: useState()" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type state = { | |
count: int, | |
}; | |
type action = | |
| Add | |
| Subtract; | |
module Counter = { | |
let component = ReasonReact.reducerComponent("Counter") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import { ConnectionHandler } from 'relay-runtime'; | |
import { isObject, isArray } from 'lodash/fp'; | |
export function listRecordRemoveUpdater({ parentId, itemId, parentFieldName, store }) { | |
const parentProxy = store.get(parentId); | |
const items = parentProxy.getLinkedRecords(parentFieldName); | |
parentProxy.setLinkedRecords(items.filter(record => record._dataID !== itemId), parentFieldName); | |
} |
NewerOlder