Skip to content

Instantly share code, notes, and snippets.

@TimRoussilhe
TimRoussilhe / column.css
Created September 27, 2021 20:25
CSS grid, responsive column with no media-queries.
grid-template-columns: repeat(auto-fill, minmax(min(425px, 100%), 1fr));
// vertex
vec3 pos = position;
float angle = atan(mouse.y - pos.y, mouse.x - pos.x);
float distance = length(mouse - pos);
float radius = ... (distance min pour déclencher l'effet)
float displacement = ... (distance max que la particle peut bouger)
float strength = clamp(distance / radius, 0.0, 1.0) * displacement;
pos += strength;
@TimRoussilhe
TimRoussilhe / images.js
Created April 1, 2019 18:47
Loading Images
window.lazySizesConfig = window.lazySizesConfig || {};
lazySizesConfig.init = false;
lazySizesConfig.loadMode = 1;
import lazySizes from 'lazysizes';
import 'lazysizes/plugins/respimg/ls.respimg';
lazySizes.init();
@TimRoussilhe
TimRoussilhe / Offset.js
Last active October 24, 2017 21:48
Modern Offset
/* global document window */
const body = document.body;
function getOffset(el) {
const scrollY = window.scrollY || window.pageYOffset;
const scrollX = window.scrollX || window.pageXOffset;
let viewportOffset = el.getBoundingClientRect();
@TimRoussilhe
TimRoussilhe / Vscode config
Last active December 2, 2017 20:28
Vscode config
{
// "workbench.colorTheme": "Monokai Dimmed",
"editor.snippetSuggestions": "top",
// "editor.formatOnPaste": true,
"editor.formatOnSave": false,
"files.trimTrailingWhitespace": true,
"javascript.format.enable": false,
"eslint.autoFixOnSave": true,
// "eslint.run": "onSave",
"editor.autoIndent": true,
{
/*
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [