Skip to content

Instantly share code, notes, and snippets.

@litewarp
litewarp / with-pgclient-resource.ts
Created February 16, 2024 04:52
WithPgClientResourceStep
import type { PgClient, PgCodec, WithPgClient } from '@dataplan/pg';
import type { PgTableResource } from '@graphile-contrib/pg-many-to-many';
import {
ExecutableStep,
type AccessStep,
type ExecutionExtra,
type GrafastResultsList,
type GrafastValuesList,
access,
type SetterStep,
@litewarp
litewarp / ClientComponent.tsx
Last active March 23, 2023 21:04
Relay Nextjs13
'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)
@litewarp
litewarp / howto.md
Last active May 25, 2022 07:31
Javascript Applet

Add the following tags to your head

<meta name="pluscriber-verification" content="YOUR PUBLICATION ID">
<script async src="https://pluscriber.com/assets/pluscriber.js"></script>
@litewarp
litewarp / Companies.js
Last active August 2, 2021 20:31
Wix Functions
const replaceCompanyName = () => {
const rows = Array.from(document.querySelector('table > tbody').childNodes);
rows.forEach(row => {
const firstChild = row.firstChild;
// text is two divs down
const contentDiv = firstChild.firstChild.firstChild;
const name = contentDiv.innerText;
const anchor = document.createElement('a');
anchor.setAttribute('style', 'text-decoration: underline');
const href = `https://legaltech.com/companies/${name.replace(/\s/g, '-').toLowerCase()}`;
// adapted twin version of below
import { Fragment } from 'react'
import { Popover, Transition } from '@headlessui/react'
import { MenuIcon, XIcon } from '@heroicons/react/outline'
import 'twin.macro'
const navigation = [
{ name: 'Product', href: '#' },
{ name: 'Features', href: '#' },
{ name: 'Marketplace', href: '#' },
@litewarp
litewarp / wrapper.ts
Last active July 4, 2021 19:27
Neo4j Work-Around for Apollo Argument Name Constraints
// temporary fix for https://github.com/neo4j/graphql/issues/292
import { wrapSchema, RenameInputObjectFields } from '@graphql-tools/wrap'
import { Neo4jGraphQL } from '@neo4j/graphql'
import { typeDefs } from './typeDefs'
// renames all InputObjectFields matching 'skip'
// see https://www.graphql-tools.com/docs/schema-wrapping#renaming
const renamingFn = (typeName: string, fieldName: string): string => {
@litewarp
litewarp / neo4j.ts
Last active November 2, 2022 13:37
Neo4j GraphQL Auth Workaround
export const neoSchema = new Neo4jGraphQL({
typeDefs,
resolver,
config: {
jwt: {
// create your own secret
secret: process.env.JWT_SECRET as string,
}
}
})
@litewarp
litewarp / Combobox.ts
Created March 16, 2021 19:37
Downshift Combobox Compound Component
import React from 'react'
import {
useCombobox,
UseComboboxProps,
UseComboboxReturnValue,
} from 'downshift'
type Item = Record<string, any>
const ComboboxContext = React.createContext<UseComboboxReturnValue<Item>>(null)
@litewarp
litewarp / recovery.sh
Created July 23, 2019 17:43 — forked from jonathantneal/recovery.sh
Create or update macOS Mojave Recovery Partition Without Reinstalling
#!/bin/sh
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
MOUNT_POINT="$MACOS_INSTALLER/Contents/SharedSupport"
echo "macOS installer is \"$MACOS_INSTALLER\""
# Set the target disk as a variable
TARGET=$(diskutil info "$(bless --info --getBoot)" | awk -F':' '/Volume Name/ { print $2 }' | sed -e 's/^[[:space:]]*//')
echo "Target disk is \"$TARGET\""
@litewarp
litewarp / rvm2rbenv.txt
Created April 18, 2019 18:22 — forked from brentertz/rvm2rbenv.txt
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################