Skip to content

Instantly share code, notes, and snippets.

View sampler.js
class Sampler {
static modeMap = new Map()
constructor( options ) {
this.samples = new Array( options?.size || 10 )
this.index = -1
}
get mean() {
@jhermsmeier
jhermsmeier / FloatingOrigin.cs
Created January 25, 2022 18:54 — forked from brihernandez/FloatingOrigin.cs
Floating origin to handle large worlds in Unity.
View FloatingOrigin.cs
// Based on the Unity Wiki FloatingOrigin script by Peter Stirling
// URL: http://wiki.unity3d.com/index.php/Floating_Origin
using UnityEngine;
using UnityEngine.SceneManagement;
public class FloatingOrigin : MonoBehaviour
{
[Tooltip("Point of reference from which to check the distance to origin.")]
public Transform ReferenceObject = null;
View parse-xyz.js
const CRLF = '\r\n'
const SP = ' '
/**
* Parse XYZ file
* @param {String} value
* @returns {Array<Vec3>}
*/
function parseXYZ( value ) {
View atmosphere.glsl
//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
// -------------------------------------
@jhermsmeier
jhermsmeier / GetOptimizationStatus.md
Created October 22, 2021 10:58 — forked from justjavac/GetOptimizationStatus.md
V8 %GetOptimizationStatus
View GetOptimizationStatus.md

%GetOptimizationStatus return a set of bitwise flags instead of a single value, to access the value, you need to take the binary representation of the returned value. Now, for example, if 65 is returned, the binary representation is the following:

(65).toString(2).padStart(12, '0');
// 000001000001

Each binary digit acts as a boolean with the following meaning:

View disable-service-workers.md
@jhermsmeier
jhermsmeier / dict.js
Created December 13, 2020 19:47
Map that supports Buffer keys via transparent keyEncoding
View dict.js
class Dict extends Map {
constructor( keyEncoding ) {
super()
keyEncoding = keyEncoding || 'base64'
if( !Buffer.isEncoding( keyEncoding ) ) {
throw new Error( `Invalid key encoding "${keyEncoding}"` )
View .gitignore
/play
/*.png
/*.bmp
/solitaire
View helpful-windows-commands.md