Skip to content

Instantly share code, notes, and snippets.

defmodule Operations do
@moduledoc """
Examples:
operations Schema.Trip, :trip
operations Schema.User, :user, only: [:get, :delete]
# supports :plural option for list_x function
operations Schema.Datum, :datum, plural: :data
"""
defmacro operations(schema, name) do
@sikanhe
sikanhe / table.tsx
Last active September 12, 2018 00:49
<Pagination
renderTableName{<b>Your Files</b>}
renderCallToAction={<BigButton>Upload</BigButton>}
totalPageCount={data.length / itemsPerPage}
>
{(pageNumber, reset) => (
<TableHead>
<Header onClick={this.sortByName(reset)}>Name</Header>
<Header onClick={this.sortByTitle(reset)}>Title</Header>
</TableHead>
@sikanhe
sikanhe / doggies.json
Last active January 3, 2023 19:14
doggies
[
{
"id": 1,
"url": "https://images.dog.ceo/breeds/pointer-germanlonghair/hans2.jpg"
},
{
"id": 2,
"url": "https://images.dog.ceo/breeds/hound-english/n02089973_3480.jpg"
},
{
@sikanhe
sikanhe / ReactCompilerPlugin.ts
Last active April 12, 2025 03:37
React Compiler plugin for ESBuild
import { readFileSync } from "node:fs"
import * as babel from "@babel/core"
import BabelPluginReactCompiler from "babel-plugin-react-compiler"
import type { Plugin } from "esbuild"
import QuickLRU from "quick-lru"
export function ReactCompilerEsbuildPlugin({
filter,
sourceMaps,
runtimeModulePath,