Skip to content

Instantly share code, notes, and snippets.

View bhouston's full-sized avatar

Ben Houston bhouston

View GitHub Profile
@bhouston
bhouston / imageServing.ts
Created December 13, 2023 14:09
old lv api image serving code.
const fileUrl = new URL(`/api/files/${fileId}/content`, API_URL);
const url = new URL('/api/images', API_URL);
url.pathname += `/webp`;
url.pathname += `/${params.width ?? 0}`;
url.pathname += 'x';
url.pathname += `${params.height ?? 0}`;
url.pathname += `/filters:format(${params.extension ?? 'png'})`;
url.pathname += `/${fileUrl}`;
@bhouston
bhouston / downloadImage.ts
Last active December 12, 2023 18:42
Save remote image to disk
import axios from 'axios';
import fs from 'fs';
import path from 'path';
async function downloadImageAsAxiosStream(url: string, filename: string) {
// Fetch the image
const response = await axios({
url,
method: 'GET',
responseType: 'stream'
@bhouston
bhouston / threads-webgl.js
Created July 6, 2023 13:04
Meta Threads.net ThreeJS WebGL Code
__d(
'useThrottledImpl',
['cr:1708227'],
function (a, b, c, d, e, f, g) {
'use strict';
g['default'] = b('cr:1708227');
},
98
);
__d(
@bhouston
bhouston / Dockerfile-npm
Last active June 1, 2023 12:55
Yarn vs NPM speed test.
FROM node:16-alpine
WORKDIR /usr/src/app
# install dependencies
COPY package*.json ./
COPY packages/shared/package*.json ./packages/shared/
COPY packages/collector/package*.json ./packages/collector/
COPY packages/frontend/package*.json ./packages/frontend/
RUN npm ci
@bhouston
bhouston / TRAAPass.js
Created May 25, 2023 01:48
Temporal Reproduction Anti-Alising for Three.js
THREE.TRAAPass = function(scene, camera, resolution) {
THREE.Pass.call(this);
this.scene = scene;
this.camera = camera;
// old velcotiy material.
function getSuperSampleTRAAMaterial() {
return new THREE.ShaderMaterial({
defines: {
import { FileLoader } from './FileLoader';
import { DataTexture } from '../textures/DataTexture';
import { DefaultLoadingManager } from './LoadingManager';
import { _Math } from '../math/Math';
function IESLoader(manager) {
this.manager = (manager !== undefined) ? manager : DefaultLoadingManager;
}
@bhouston
bhouston / index.html
Created May 20, 2021 19:11
Reproduction of unreliable AR intents for SceneViewer on Android - 2021-05-20
<input type="text" id="modelUrl" style="width:100%" value="http://exocortex.github.io/glb-crash/icosphere.glb">
<br>
<a id="link"></a>
<script>
function setUrl(url) {
link.innerHTML = url;
link.href = `intent://arvr.google.com/scene-viewer/1.0?enable_vertical_placement=true&file=${escape(url)}&mode=ar_only&resizable=false&title=AR#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;end`
}
@bhouston
bhouston / note.mjs
Created August 8, 2020 16:14
parse gitlab time spends from notes
import { Spend } from '../plan/model.mjs';
import nodemon from 'nodemon';
import { log, logPush, logPop } from '../logging.mjs';
var spendBodyRegex = /(?<operation>(added|subtracted)) (?<duration>([0-9]+[mowdhs]+ )*)(of time spent at )(?<date>[0-9\-]+)/;
var spendResetBody = "removed time spent";
//var durationRegex = new RegExp( '^((?<months>[0-9]+)mo(\\w)*)?((?<weeks>[0-9]+)w(\\w)*)?((?<days>[0-9]+)d(\\w)*)?((?<hours>[0-9]+)h(\\w)*)?((?<minutes>[0-9]+)m(\\w)*)?((?<seconds>[0-9]+)s(\\w)*)?' );

The capacities of glslify are the following:

#pragma glslify: topDot = require(./my-function.glsl)

It allows for the import of a named function from another class. This likely works in a recursive fashion.


  • It does not allow for inline javascript execution.
  • It does not output JS modules.
let arrayBuffer = new ArrayBuffer( 12 * 16 );
let floatArray = new Float32Array( arrayBuffer );
let intArray = new Int32Array( arrayBuffer );
function hashFloat1( v ) {
floatArray[0] = v;
return intArray[0];
}
function hashFloat2( v0, v1 ) {