Skip to content

Instantly share code, notes, and snippets.

@WebReflection
WebReflection / custom-elements-pattern.md
Last active February 14, 2024 00:13
Handy Custom Elements' Patterns

Handy Custom Elements' Patterns

Ricardo Gomez Angel Photo by Ricardo Gomez Angel on Unsplash

This gist is a collection of common patterns I've personally used here and there with Custom Elements.

These patterns are all basic suggestions that could be improved, enriched, readapted, accordingly with your needs.

@xem
xem / readme.md
Last active April 5, 2024 23:16
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

--[[------------------------------------
RandomLua v0.3.1
Pure Lua Pseudo-Random Numbers Generator
Under the MIT license.
copyright(c) 2011 linux-man
--]]------------------------------------
local math_floor = math.floor
local function normalize(n) --keep numbers at (positive) 32 bits
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active May 5, 2024 09:04
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@ripter
ripter / General.markdown
Created September 10, 2012 19:26
JavaScript Test

General

  • What JS libraries have you used?
    • Why that over X?
  • What JS tempting libraries have you used?
  • How do you organize your code?
  • Have you used CoffeeScript?
    • What do you like/dislike about it?
    • Advantages/Disadvantages over JavaScript?