This file contains 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 { TinyBaseSynchronizedPartyKitServer } from "@/party/TinyBaseSynchronizedPartyKitServer.ts"; | |
import type * as Party from "partykit/server"; | |
export default class Server | |
extends TinyBaseSynchronizedPartyKitServer | |
implements Party.Server | |
{ | |
constructor(readonly room: Party.Room) { | |
super(room); | |
} |
This file contains 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
# GitHub Action that will run prettier on the whole repo and commit the changes to the PR. | |
name: Prettier | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
prettier: | |
runs-on: ubuntu-latest |
This file contains 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 function detangle() { | |
let blocked = false | |
return callback => (...args) => { | |
if (blocked) return | |
blocked = true | |
callback(...args) |
This file contains 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
---Utility for keymap creation. | |
---@param lhs string | |
---@param rhs string|function | |
---@param opts string|table | |
---@param mode? string|string[] | |
local function keymap(lhs, rhs, opts, mode) | |
opts = type(opts) == 'string' and { desc = opts } | |
or vim.tbl_extend('error', opts --[[@as table]], { buffer = bufnr }) | |
mode = mode or 'n' | |
vim.keymap.set(mode, lhs, rhs, opts) |
This file contains 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
async function detectPush0Support(rpcs) { | |
return (await Promise.all(rpcs.map(async rpc => { | |
try { | |
const res = await fetch(rpc, { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json" | |
}, | |
body: JSON.stringify({ | |
"method": "eth_call", |
This file contains 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
# INSPECT | |
function inspect () { | |
eval NODE_OPTIONS="--inspect-brk" $@ | |
} | |
# INSPECT PLUGIN | |
# Toggles the "inspect " prefix upon double ESC key | |
function plugin-inspect () { |
This file contains 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
new Temporal.ZonedDateTime(nano, timeZone, calendar) | |
/* instead: */ Temporal.Instant.fromEpochMilliseconds(milli) | |
/* */ .toZonedDateTimeISO(timeZone) | |
/* OR */ | |
/* instead: */ Temporal.Instant.fromEpochMilliseconds(milli) | |
/* */ .toZonedDateTime({ timeZone, calendar }) | |
zonedDateTime.epochMicroseconds | |
/* instead: */ zonedDateTime.epochMilliseconds |
This file contains 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
// ==UserScript== | |
// @name 3D DOM viewer | |
// @namespace https://gist.github.com/hf02/2f2fb776ba233fd758af559b9de9e177 | |
// @version 2024-03-27 | |
// @description 3D DOM viewer | |
// @author OrionReed (forked by hf02) | |
// @match *://*/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant GM_registerMenuCommand | |
// ==/UserScript== |
This file contains 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 { SigningStargateClient } from '@cosmjs/stargate' | |
import { fromBase64, toBase64 } from '@cosmjs/encoding' | |
import { makeAuthInfoBytes, makeSignDoc } from '@cosmjs/proto-signing' | |
import { Int53 } from '@cosmjs/math' | |
import { Any } from 'cosmjs-types/google/protobuf/any' | |
import { PubKey } from 'cosmjs-types/cosmos/crypto/secp256k1/keys' | |
import { AuthInfo, Fee, Tx, TxBody, TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx' | |
import { isDev } from '@/helpers/env' | |
import { OfflineDirectSigner } from '@cosmjs/proto-signing/build/signer' | |
import { StdFee } from '@cosmjs/amino' |
This file contains 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
#!/usr/bin/env bash | |
set -e | |
# Constants, run forge build --sizes first to see existing build size | |
# TODO Have a MAX_SIZE value for current build configuration? | |
TARGET_SIZE=6.250 | |
MIN_RUNS=200 | |
# Explanation of MAX_RUNS: Etherscan does not support verifying contracts with more than 10,000,000 optimizer runs. | |
# Using a higher number might not affect the bytecode output, but verification might require "spoofing" the optimizer run count. |
NewerOlder