Skip to content

Instantly share code, notes, and snippets.

View terkelg's full-sized avatar
🔵
Git'n stuff done

Terkel terkelg

🔵
Git'n stuff done
View GitHub Profile
#![feature(lang_items)]
#![no_std]
#[no_mangle]
pub fn add_one(x: i32) -> i32 {
x + 1
}
// needed for no_std
@laurenfazah
laurenfazah / authentication_with_express_postgres.md
Last active July 13, 2024 16:51
Authentication with an Express API and Postgres

Authentication with an Express API and Postgres

Setting Up

Let's make sure our Express app has the required base modules:

# within root of API
npm install --save express pg knex bcrypt
npm install --save-dev nodemon
//--------------------------------------------------------------------------//
// Flow field animator by Etienne Jacob (www.necessary-disorder.tumblr.com) //
// Processing code (https://processing.org) //
// Saves frames, then you must use something else to make the GIF //
//--------------------------------------------------------------------------//
/// This code starts with the rendering system I took from @beesandbombs
/// (it also contains some useful functions and stuff)
/// You don't have to understand it
/// Just know that it does an average on many drawings to get a motion blur effect
/// from drawings parametrized by the global variable t going from 0 to 1
@ayamflow
ayamflow / texture-atlas.js
Last active November 21, 2023 01:22
threejs Texture Atlas (TexturePacker spritesheet)
import _ from 'underscore';
export default class TextureAtlas {
constructor(json, image) {
this._textures = {};
let texture = new THREE.Texture(image);
texture.needsUpdate = true;
let frames = json.frames;
_.keys(frames).forEach(function(key, i) {
@bendc
bendc / raf-delay.js
Created August 28, 2017 13:19
rAF tutorial: better setTimeout
const delay = (callback, duration) => {
const tick = () =>
getProgress(time) < 1 ? requestAnimationFrame(tick) : callback();
const time = {
duration,
id: requestAnimationFrame(tick)
};
};
@joshfarrant
joshfarrant / puck.js
Created May 8, 2017 08:14
Puck.js example code
const UUIDS = {
INFO: 0x180A,
TEMPERATURE: 0x1809,
BATTERY: 0x180F,
};
const mainLoopTimeout = 60000;
const buttonPressTimeout = 5000;
const buttonInitialValue = 0;
const buttonValueIncrement = 10;
@ayamflow
ayamflow / gist:96a1f554c3f88eef2f9d0024fc42940f
Last active April 3, 2025 22:26
Threejs Fit plane to screen
var cameraZ = camera.position.z;
var planeZ = 5;
var distance = cameraZ - planeZ;
var aspect = viewWidth / viewHeight;
var vFov = camera.fov * Math.PI / 180;
var planeHeightAtDistance = 2 * Math.tan(vFov / 2) * distance;
var planeWidthAtDistance = planeHeightAtDistance * aspect;
// or
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active April 19, 2025 01:52
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
@developit
developit / hydra-alias.md
Last active February 27, 2020 01:54
Alias to invoke Chrome Canary w/ tracing, for IRHydra

An Alias to run Chrome with tracing enabled

For Chrome Canary:

alias hydra='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --no-sandbox --js-flags="--user-data-dir=/tmp/profile --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces"'

For regular ol' Chrome: