Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Matt DesLauriers mattdesl

👋
View GitHub Profile
@mattdesl
mattdesl / rect.ryu
Last active Jan 16, 2023
quadtree subdivision with ryu (this could probably be written in a more functional style...)
View rect.ryu
; draws a rectangle on canvas
(fn draw-rect (x y w h) (do
(canvas/line x y (+ x w) y)
(canvas/line (+ x w) y (+ x w) (+ y h))
(canvas/line x (+ y h) (+ x w) (+ y h))
(canvas/line x y x (+ y h))
))
; array utility - for-each
(fn each (arr itr)
@mattdesl
mattdesl / homage-2022-01-06.ryu
Created Jan 6, 2023
homage to the square in the esolang ryu, #genuary 2022, prompt: "steal like an artist"
View homage-2022-01-06.ryu
(fn loop (n iter) (do
(var i 0)
(while (< i n) (do
(iter i)
(set i (+ 1 i))
))
))
(var colors [
"#E84420" "#F4CD00" "#3E58E2"
View example.ryu
; a function in scope
(fn square (x) (* x x))
; anon/lambda function
((fn (x) (* x x)) 3) ; 9
; variables
(var square2 4)
; let scoping
@mattdesl
mattdesl / sketch-jan5.ryu
Last active Jan 5, 2023
example of Ryu syntax (all built-in APIs are unstable)
View sketch-jan5.ryu
; a loop utility
(fn loop (n iter) (do
(var i 0)
(while (< i n) (do
(iter i)
(set i (+ 1 i))
))
))
(var BG 0xff)
View ramps.md

Fiat-Based "Transaction Processors"

It would be interesting to see a fiat service for broadcasting Ethereum transactions to the network. Right now, most fiat on-ramps come in two flavours:

  1. A centralized exchange (like Coinbase, FTX and Binance). Poor user experience, slow, questionable regulatory frameworks, lack of transparency, often turn out to be insolvent.
  2. A fiat-to-token on-ramp (like Ramp.xyz and more recently Stripe). Better user experience, but limited in functionality and progammability.

I think there should be a third category: fiat-based transaction processors. Say you are an app developer and wish for your user to initiate a complex transaction flow, e.g.

call method CrowdfundContract#deposit(), but it requires a transfer of 5 USDC to the contract to succeed

@mattdesl
mattdesl / art.tal
Last active Dec 16, 2022
License: MIT
View art.tal
( artwork )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
|0000
@framecount $1
%MOD { DUP2 DIV MUL SUB } ( a b -- a%b )
View about.md

1. Download your Twitter archive

You can find this feature in Settings > Download Twitter Archive. It might take 24 hours to receive. Unzip the file and open the data folder in your terminal:

cd ~/Downloads/twitter-archive-zip-you-downloaded/data

(I have seen reports that this function may no longer be working, so this guide is mostly useful to those who were lucky enough to already have downloaded their archive.)

@mattdesl
mattdesl / scale.js
Created Nov 4, 2022
meridian scaling script
View scale.js
let width, height, pixelRatio;
const W = window;
const defaultAspect = 9 / 16;
const aspect = W.A || defaultAspect;
const targetHeight = W.S || 2048;
const targetWidth = ~~(targetHeight * aspect);
const inputHeight = W.H || W.innerHeight * W.devicePixelRatio;
const targetRatio =
W.R != null ? W.R : Math.max(1, inputHeight / targetHeight);
@mattdesl
mattdesl / ABI.json
Created Oct 10, 2022
fetch Meridian locally from the blockchain
View ABI.json
[
{
"constant": true,
"inputs": [
{ "internalType": "uint256", "name": "_projectId", "type": "uint256" },
{ "internalType": "uint256", "name": "_index", "type": "uint256" }
],
"name": "projectScriptByIndex",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"payable": false,
@mattdesl
mattdesl / results.md
Last active Sep 29, 2022
meridian-voting-results
View results.md

Meridian Community Curated Voting Results

The winning results from the Meridian community curation.

Most Voted On Per Style

Charcoal
#638