Skip to content

Instantly share code, notes, and snippets.

View miguelrk's full-sized avatar

miguelrk

View GitHub Profile
@izakfilmalter
izakfilmalter / useFilterQuery.tsx
Last active June 4, 2025 11:42
Zero + bazza/ui filters
import type { FiltersState } from '@/components/data-table-filter/core/types'
import { filtersSchema } from '@/components/data-table-filter/core/types'
import type { FilterKeys } from '@/data/globalState'
import { noOp } from '@/shared/things'
import { useZero } from '@/shared/zero/useZero'
import type { ZSchema } from '@/shared/zero/zeroSchema.mjs'
import { escapeLike, type Query, type TTL } from '@rocicorp/zero'
import { useQuery } from '@rocicorp/zero/react'
import { getTime } from 'date-fns/fp'
import { Array, Boolean, Option, pipe, String } from 'effect'
@marvinhagemeister
marvinhagemeister / bind-plugin.ts
Last active June 8, 2025 06:48
Preact Signals `bind:value`
import { options } from "preact";
import { Signal } from "@preact/signals";
// Add `bind:value` to JSX types
declare global {
namespace preact.createElement.JSX {
interface HTMLAttributes {
"bind:value"?: Signal<string | string[] | number | undefined>;
}
}
@DavidWells
DavidWells / javascript-proxy-as-rest-client.js
Last active May 12, 2024 14:24
Using a javascript proxy as low code REST client
/* Using a JavaScript proxy for a super low code REST client */
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3
// also see https://github.com/fastify/manifetch
// also see https://github.com/flash-oss/allserver
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {
@danielpeintner
danielpeintner / example-client.js
Last active November 2, 2022 07:46
node-wot (basic authentication)
// example-client.js
Servient = require("@node-wot/core").Servient
HttpClientFactory = require("@node-wot/binding-http").HttpClientFactory
Helpers = require("@node-wot/core").Helpers
// create Servient and add HTTP binding
let servient = new Servient();
servient.addCredentials({
"urn:dev:wot:org:eclipse:thingweb:my-example-secure": {