Skip to content

Instantly share code, notes, and snippets.

@vorg
vorg / risograph-grid.js
Created January 5, 2024 13:34
risograph-grid.js
//assumes A1 sized Canvas 2245x3179
import {
fromRGBBytes,
toHex,
fromHex,
create as createColor,
toHSLuv,
toRGBBytes,
} from "pex-color";
import {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://unpkg.com/tachyons@4.12.0/css/tachyons.min.css"
/>
<title>All The Slides</title>
module.exports = (node, graph) => {
const triggerIn = node.triggerIn("in");
const triggerOut = node.triggerOut("out");
const timeIn = node.in("time", 0);
const textureIn = node.in("texture", null);
const rotationIn = node.in("rotation", 0)
const ctx = graph.ctx;
const drawCmd = {
@vorg
vorg / tzprofile
Last active November 22, 2021 11:31
I am attesting that this GitHub handle vorg is linked to the Tezos account tz1aBgHQm9KrJ4WrZkfkzS6BEykYbDXP8znU for tzprofiles
sig:edsigtY14o7PVYqGosGD8eZMq3eZ4dwGg1QCLa411jmJZ6CsZtHAqa4P16rAHhr832EQQX8mi9zLAszV5WtVpZPg1eA3c3LH92y
module.exports = function (node, graph) {
const canvasScreenshot = require('canvas-screenshot').default
const triggerIn = node.triggerIn('in')
const triggerOut = node.triggerOut('out')
const fpsIn = node.in('fps', 30, { precision: 0, connectable: false })
const durationIn = node.in('duration (s)', 10)
const onStartRecordingOut = node.triggerOut('onStartRecording')
let recording = false
@vorg
vorg / webgpu-screenshot.js
Last active August 31, 2021 00:26
Minimal example of making screenshot of WebGPU canvas
//Tested on Chrome Canary Version 94.0.4598.0, macOS 11.5
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 512;
document.body.appendChild(canvas);
const clearColor = {
r: Math.random(),
g: Math.random(),
//MIT License
//Copyright (c) 2021 Felix Westin
//Source: https://github.com/Fewes/MinimalAtmosphere
//Ported to GLSL by Marcin Ignac
#ifndef ATMOSPHERE_INCLUDED
#define ATMOSPHERE_INCLUDED
// -------------------------------------
@vorg
vorg / tabdump.scpt
Last active August 12, 2022 11:56
Copy all Safari tabs title and url as markdown
(*Adapted from https://stackoverflow.com/a/39820517*)
set r to "" -- an empty variable for appending a string
tell application "Safari"
repeat with w in windows -- loop for each window, w is a variable which contain the window object
if exists current tab of w then -- is a valid browser window
repeat with t in tabs of w -- loop for each tab of this window, , t is a variable which contain the tab object
-- get the title (name) of this tab and get the url of this tab
tell t to set r to r & "- [ ] [" & name & "](" & URL & ")" & linefeed -- append a line to the variable (r)
(*
'linefeed' mean a line break
@vorg
vorg / sphere.js
Created June 13, 2018 09:56
textured primitive sphere
const createContext = require('pex-context')
const createSphere = require('primitive-sphere')
const mat4 = require('pex-math/mat4')
const createCamera = require('pex-cam/perspective')
const createOrbiter = require('pex-cam/orbiter')
const load = require('pex-io/load')
const vec3 = require('pex-math/vec3')
const W = window.innerWidth
const H = window.innerHeight
@vorg
vorg / index.js
Created March 18, 2018 02:18
Minimal pex-v2 example
const createContext = require('pex-context')
const createCube = require('primitive-cube')
const createCamera = require('pex-cam/perspective')
const createOrbiter = require('pex-cam/orbiter')
const ctx = createContext()
const cube = createCube()
const camera = createCamera({
fov: Math.PI / 3,
aspect: window.innerWidth / window.innerHeight