Skip to content

Instantly share code, notes, and snippets.

View hrahimi270's full-sized avatar
🏠
Working from home

Hossein Rahimi hrahimi270

🏠
Working from home
View GitHub Profile
@msarsha
msarsha / hooks.md
Created October 18, 2019 13:34
Setting up git hooks with husky, commitlint and prettier
  1. npm install prettier --save-dev --save-exact

  2. npx mrm lint-staged

  3. npm install --save-dev @commitlint/{cli,config-conventional}

  4. echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commitlint.config.js

  5. edit package.json:

  "husky": {
    "hooks": {
@rijkvanzanten
rijkvanzanten / percentage-in-view.js
Last active December 8, 2023 18:32
Get how much percentage an element is in view in plain JavaScript
function getViewPercentage(element) {
const viewport = {
top: window.pageYOffset,
bottom: window.pageYOffset + window.innerHeight
};
const elementBoundingRect = element.getBoundingClientRect();
const elementPos = {
top: elementBoundingRect.y + window.pageYOffset,
bottom: elementBoundingRect.y + elementBoundingRect.height + window.pageYOffset
@nesimtunc
nesimtunc / ImageController.js
Last active January 8, 2024 01:43
Minio Server - NodeJS - File Upload & Photo Showing Example
const formidable = require('formidable');
const fs = require('fs');
var Minio = require('minio');
let minioClient = new Minio.Client({
endPoint: config.MINIO.ENDPOINT,
port: config.MINIO.PORT,
accessKey: config.MINIO.ACCESS_KEY,
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active March 28, 2024 15:10
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);