Skip to content

Instantly share code, notes, and snippets.

View SuneBear's full-sized avatar

Shule Hsiung SuneBear

View GitHub Profile
export const chaosTestStrings = (): void => {
const textNodes = getAllTextNodes(document.body);
for (const node of textNodes) {
const textNodeLength = node.textContent ? node.textContent.length : 0;
if (node.textContent === null) {
return;
}
if (node.parentElement instanceof Element) {
if (node.parentElement.dataset.originalText === undefined) {
@JohannesDeml
JohannesDeml / README.md
Created June 29, 2021 08:09
Unity WebGL framework code

Unity WebGL engine code

This includes the framework and loader. I took a look at the webassembly code with wasm2js , but it is not that interesting for finding hidden variables.

This gist is meant to help find variables and methods that can help you in development such as UTF8ToString or TOTAL_MEMORY.

@mattdesl
mattdesl / README.md
Last active November 18, 2021 13:14
seedable PRNG from hash
@bgolus
bgolus / StereographicProjectionBubble.shader
Created February 28, 2020 06:33
Modifying UVs using stereographic projection to create the illusion of a sphere.
Shader "Unlit/StereographicProjectionBubble"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_PanSpeed ("Pan Speed", Float) = 0.1
_Spherify ("Spherify", Range(0,1)) = 1
}
SubShader
{
@adambradford
adambradford / style.css
Last active February 8, 2022 09:08
Halftone overlay effect for background images in CSS
.container {
background: url('path/to/background.jpg');
background-size: cover;
background-repeat: no-repeat;
position: relative; /* use this if optional inner container is used */
}
.container:after {
background-image: linear-gradient(45deg, #666 25%, transparent 25%),
linear-gradient(-45deg, #666 25%, transparent 25%),
@LiekeVanmulken
LiekeVanmulken / Perlin_js_impl.js
Created October 5, 2017 12:35
Perlin implementation in javascript, ported from https://gist.github.com/Flafla2/f0260a861be0ebdeef76
// Implementation of perlin noise, ported from https://gist.github.com/Flafla2/f0260a861be0ebdeef76 to js.
var repeat = -1;
var setRepeat = function(repeat) {
this.repeat = repeat;
};
/**
@ayamflow
ayamflow / gist:96a1f554c3f88eef2f9d0024fc42940f
Last active May 15, 2024 12:37
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
@mattdesl
mattdesl / billboard.glsl
Created January 18, 2017 22:52
billboarding in GLSL
attribute vec3 position;
uniform mat4 modelViewMatrix;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
uniform float scale;
uniform float size;
uniform float aspect;
varying vec2 vUv;
@thorsten
thorsten / setUserAgent.js
Created May 9, 2016 15:12
Override user agent on all browsers
function setUserAgent(window, userAgent) {
// Works on Firefox, Chrome, Opera and IE9+
if (navigator.__defineGetter__) {
navigator.__defineGetter__('userAgent', function () {
return userAgent;
});
} else if (Object.defineProperty) {
Object.defineProperty(navigator, 'userAgent', {
get: function () {
return userAgent;
@btroncone
btroncone / ngrxintro.md
Last active February 9, 2024 15:37
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents