Skip to content

Instantly share code, notes, and snippets.

View nilslice's full-sized avatar
💻
// TODO: lots

Steve Manuel nilslice

💻
// TODO: lots
View GitHub Profile
@nilslice
nilslice / index.ts
Created April 3, 2024 05:22
Supabase Edge Function + Extism
import createPlugin from 'https://raw.githubusercontent.com/extism/js-sdk/main/src/mod.ts';
// This could be done inside the server handler too -- but we'll just load one plugin for the exmple
const plugin = await createPlugin(
'https://github.com/extism/plugins/releases/latest/download/count_vowels.wasm',
{ useWasi: true }
);
// call this server with a request like:
// curl -X POST -d '{"input": "this is a test"}' localhost:8000
package main
import (
"time"
pdk "github.com/extism/go-pdk"
)
type JsonTime struct {
Time time.Time `json:"time"`
// generated code from wasm_bindgen from source Rust code...
import wasm from './export_wasm.mjs'
const heap = new Array(32).fill(undefined);
heap.push(undefined, null, true, false);
function getObject(idx) { return heap[idx]; }

Keybase proof

I hereby claim:

  • I am nilslice on github.
  • I am nilslice (https://keybase.io/nilslice) on keybase.
  • I have a public key ASBtTLIzSmawBSLFgp3V8jmh9NhwqmxtdH-9geavdU-B0Ao

To claim this, I am signing this object:

/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.
# tell the CLI to generate a "Song" content type, with Title, Artist, Rating, Opinion and SpotifyUrl fields
$ ponzu gen content song title:"string" artist:"string" rating:"int" opinion:"string":richtext spotify_url:"string"
# then run and build the project and open up your web browser!
package content
import (
"github.com/ponzu-cms/ponzu/management/editor"
"github.com/ponzu-cms/ponzu/system/item"
)
type Review struct {
item.Item
@nilslice
nilslice / build.sh
Last active August 29, 2015 14:24 — forked from treeder/build.sh
docker run --rm -it -v "$GOPATH":/go -w /go/src/github.com/iron-io/ironcli golang:1.4.2-cross sh -c '
for GOOS in darwin linux windows; do
for GOARCH in 386 amd64; do
echo "Building $GOOS-$GOARCH"
export GOOS=$GOOS
export GOARCH=$GOARCH
go build -o bin/ironcli-$GOOS-$GOARCH
done
done
'