Skip to content

Instantly share code, notes, and snippets.

View mauriciomassaia's full-sized avatar

Mauricio Massaia mauriciomassaia

View GitHub Profile
@jancassio
jancassio / useMatchMedia.md
Created March 20, 2023 02:14
React hook to trigger updates when a media queries matches or not its query.

useMatchMedia hook

Allow to obtain match responses of given media query list items.

Details

This hook relies on window.matchMedia to provide precise updates when some media query matches or not its requirements. It will also handle and dispose event listeners properly and avoid uncessary re-renders.

API

@marciopuga
marciopuga / gif.sh
Last active January 13, 2022 11:37
video to gif using ffmpeg with superior quality
#!/bin/sh
# run docker version instead of local installation
alias ffmpeg='docker run -v=`pwd`:/tmp/ffmpeg opencoconut/ffmpeg'
palette="palette.png"
# adjust fps here if you need to
filters="fps=10,scale=$1:-1:flags=lanczos"
@psenger
psenger / .gitignore
Last active August 19, 2021 22:27
[How to generate a GIT Hash Version for APIS and Programs] #git
.gen-version.js
@PetterRuud
PetterRuud / query.groq
Created April 19, 2021 20:33
GROQ query to pull data for image palette information
*[_id =="documentWithImage"]{
...,
image{
..., // Get all information
"palette": asset->metadata.palette // Pull palette from metadata on the asset
}
}
@mauriciomassaia
mauriciomassaia / git-release.md
Last active November 15, 2021 23:37
Git Release

Create a new branch from development:

git checkout -b release/[new version here]

git checkout -b release/1.0.0

tip: run cat package.json| grep version to check the current version before creating the release branch.

Then bump the version [ major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id> ]

@Tahul
Tahul / ThreeJS TypeScript GLTF GLB Scene.ts
Last active August 10, 2021 06:29
[ThreeJS Typescript Simple GLTF/GLB Scene] A simple GLTF/GLB scene loader using TypeScript. #threejs, #gltf, #glb, #loader, #typescript
import {
PerspectiveCamera,
DirectionalLight,
HemisphereLight,
Scene,
WebGLRenderer,
Color,
Clock,
} from 'three'
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
@jancassio
jancassio / README.md
Last active March 6, 2020 11:26
React Hooks

React Hooks

useImage

Provides an image from a respective URL

Usage

const Component = ({ src, alt, width = 320, height = 240, fallback }) => {
// constants
const float PI = 3.1415925654;
// colorspace conversion
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
@markknol
markknol / shadertoy.md
Last active June 24, 2024 17:51
Shader cheatsheet (from shadertoy)

This help only covers the parts of GLSL ES that are relevant for Shadertoy. For the complete specification please have a look at GLSL ES specification

Language:

Version: WebGL 2.0
Arithmetic: ( ) + - ! * / %
Logical/Relatonal: ~ < > <= >= == != && ||
Bit Operators: & ^ | << >>
Comments: // /* */
Types: void bool int uint float vec2 vec3 vec4 bvec2 bvec3 bvec4 ivec2 ivec3 ivec4 uvec2 uvec3 uvec4 mat2 mat3 mat4 mat?x? sampler2D, sampler3D samplerCube
Format: float a = 1.0; int b = 1; uint i = 1U; int i = 0x1;

@eduardomartines
eduardomartines / motospeed_ck62.ahk
Last active April 11, 2023 00:41
Motospeed CK62 - Autohotkey Script
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetCapsLockState, AlwaysOff
CapsLock & ,:: Send {Del}
CapsLock & .:: Send {End}
CapsLock & k:: Send {Ins}