- Search, user:@me searchTerm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // new HotKeys().reg( 'ctrl+s', e=>console.log( 'woot' ) ); | |
| export default class HotKeys{ | |
| items = []; | |
| constructor(){ window.addEventListener( 'keydown', this.onKeyDown ); } | |
| dispose(){ window.removeEventListener( 'keydown', this.onKeyDown ); } | |
| reg( str, fn ){ | |
| // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as THREE from 'three'; | |
| export default class SkyGradientMaterial extends THREE.RawShaderMaterial { | |
| static createBox(scl = 1): THREE.Mesh { | |
| const geo = new THREE.BoxGeometry(2, 2, 2); | |
| const mesh = new THREE.Mesh(geo, new SkyGradientMaterial()); | |
| mesh.scale.setScalar(scl); | |
| return mesh; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function downloadText(fName: string, txt: string) { | |
| const blob = new Blob([txt], { type: 'text/plain;charset=utf-8;' }); | |
| const url = window.URL.createObjectURL(blob); | |
| const link = document.createElement('a'); | |
| link.href = url; | |
| link.download = fName; | |
| link.target = '_blank'; | |
| // link.click(); | |
| link.dispatchEvent(new MouseEvent('click')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as THREE from 'three'; | |
| class CustomMaterial extends THREE.RawShaderMaterial { | |
| constructor( props={} ){ | |
| super(); | |
| // Merge custom props with default options | |
| const opts = Object.assign( | |
| { | |
| offset : [ 0, 1, 0 ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Clone an event then dispatch it to an HTML Element | |
| function dispatchClonedEvent( e: Event, elm:HTMLElement ){ | |
| if( e.type.startsWith( 'pointer' ) ){ | |
| const evt = e as PointerEvent; | |
| elm.dispatchEvent( new PointerEvent( evt.type, { | |
| bubbles : evt.bubbles, | |
| cancelable : evt.cancelable, | |
| clientX : evt.clientX, | |
| clientY : evt.clientY, | |
| button : evt.button, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const noaaRamp = [ | |
| { color: "#ffffff", elevation: 8000 }, | |
| { color: "#E0D7D0", elevation: 4000 }, | |
| { color: "#CDB99C", elevation: 2000 }, | |
| { color: "#BA9468", elevation: 1000 }, | |
| { color: "#9B7E43", elevation: 500 }, | |
| { color: "#75752D", elevation: 250 }, | |
| { color: "#456C18", elevation: 50 }, | |
| { color: "#175515", elevation: 10 }, | |
| { color: "#004023", elevation: 0.1 }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "editor.tokenColorCustomizations": { | |
| "comments": "#606060" | |
| } | |
| // Disable copilot | |
| "github.copilot.enable": { | |
| "*": false, | |
| "plaintext": false, | |
| "markdown": false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import mlx.core as mx | |
| @mx.compile | |
| def _compute_T1(A): | |
| """I + A""" | |
| return mx.eye(A.shape[-1]) + A | |
| @mx.compile | |
| def _compute_T2(A): | |
| """I + A + A^2/2""" | |
| A2 = A @ A | |
| return mx.eye(A.shape[-1]) + A + A2/2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html><html lang="en"><head><title></title></head> | |
| <style>canvas{ display:block; } body, html { padding:0px; margin:0px; width:100%; height:100%; }</style> | |
| <body><script type="module"> | |
| // #region IMPORTS | |
| import useForcedWebGL, { THREE, useDarkScene } from '../lib/useForcedWebGL.js'; | |
| // #endregion | |
| // #region MAIN | |
| let App = useDarkScene( useForcedWebGL() ); | |
| let Debug = {}; |
NewerOlder