Skip to content

Instantly share code, notes, and snippets.

@jh3y
jh3y / gsap-eases.css
Last active July 26, 2025 00:30
GreenSock eases with CSS linear()
:root {
--none: linear(0, 1);
--power1-in: linear( 0, 0.0039, 0.0156, 0.0352, 0.0625, 0.0977, 0.1407, 0.1914, 0.2499, 0.3164, 0.3906 62.5%, 0.5625, 0.7656, 1 );
--power1-out: linear( 0, 0.2342, 0.4374, 0.6093 37.49%, 0.6835, 0.7499, 0.8086, 0.8593, 0.9023, 0.9375, 0.9648, 0.9844, 0.9961, 1 );
--power1-in-out: linear( 0, 0.0027, 0.0106 7.29%, 0.0425, 0.0957, 0.1701 29.16%, 0.2477, 0.3401 41.23%, 0.5982 55.18%, 0.7044 61.56%, 0.7987, 0.875 75%, 0.9297, 0.9687, 0.9922, 1 );
--power2-in: linear( 0, 0.0014 11.11%, 0.0071 19.24%, 0.0188 26.6%, 0.037 33.33%, 0.0634 39.87%, 0.0978 46.07%, 0.1407 52.02%, 0.1925 57.74%, 0.2559 63.49%, 0.3295 69.07%, 0.4135 74.5%, 0.5083 79.81%, 0.6141 85%, 0.7312 90.09%, 1 );
--power2-out: linear( 0, 0.2688 9.91%, 0.3859 15%, 0.4917 20.19%, 0.5865 25.5%, 0.6705 30.93%, 0.7441 36.51%, 0.8075 42.26%, 0.8593 47.98%, 0.9022 53.93%, 0.9366 60.13%, 0.963 66.67%, 0.9812 73.4%, 0.9929 80.76%, 0.9986 88.89%, 1 );
--power2-in-out: linear( 0, 0.0036 9.62%, 0.0185 16.66
function partition(inputArray, callback) {
const result = {};
for (const [indexOfValue, value] of inputArray.entries()) {
const propertyKey = callback(value, indexOfValue);
if (propertyKey === null || propertyKey === '') {
continue;
}
if (!{}.hasOwnProperty.call(result, propertyKey)) {
result[propertyKey] = [];
}
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active August 28, 2025 15:49
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@dasilvaluis
dasilvaluis / gulpfile.js
Last active September 27, 2021 09:34
Gettext Scanner Gulp Script for Twig Projects
/**
* Gettext Scanner Script for Twig Projects
* v1.3
*
* Developed by Luís Silva
* https://github.com/luism-s
*/
/**
* Purpose:
@Anthodpnt
Anthodpnt / mixing-text.js
Last active December 13, 2016 22:38
Misc - Mixing Text
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <[email protected]>
* @site: https://www.twitter.com/JsGists
*
* A trendy effect to add to your websites is to mix some text to create a sort of glitch.
* They are many styles and ways to mix text and create this kind of effect but let me show
* you an easy solution to manipulate a string and mix it.
*
* Example:
@Anthodpnt
Anthodpnt / request-animation-frame.js
Last active July 16, 2019 18:09
Performance - Request Animation Frame
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <[email protected]>
* @site: https://www.twitter.com/JsGists
*
* You sometimes need to run some code multiples times, on window scroll, on window resize
* or simply every n milliseconds. But what if you want you code to run 60 times per seconds ?
* You could defenitely use a `setTimeout` and even if it's not the best solution
* it would work but! there is a much easier solution, `requestAnimationFrame` (rAF).
*
@Anthodpnt
Anthodpnt / image-loader.js
Last active December 13, 2016 22:37
Misc - Image Loader
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <[email protected]>
* @site: https://www.twitter.com/JsGists
*
* We you build your project you sometimes need to load (you should load) your assets.
* One of the main type of asset you're using is `images` and if you don't load them
* it could easily destroy your user experience.
* I will not show you how to create a complete loader, I'll only show you how to code
* a simple loader to load your images.
@Anthodpnt
Anthodpnt / round-to-decimal.js
Last active December 13, 2016 16:10
Math - Round to Decimal
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <[email protected]>
* @site: https://www.twitter.com/JsGists
* @source: Coding Math/Keith Peters
*
* You often get floating numbers in Javascript and sometimes you need to round them and
* keep only n decimals. They are many solutions to do so but let me show you my favorite.
*
* Example:
@Anthodpnt
Anthodpnt / add-leading-zero.js
Last active December 13, 2016 16:09
Formatting - Add Leading Zero
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <[email protected]>
* @site: https://www.twitter.com/JsGists
*
* You need sometimes to format you number and one of the common way to format them is to add a leading zero
* to numbers less than 10. There is many ways of doing this so let me show you some of them.
*
* Example:
* I have a number and I want to prepend a 0 to it if it's less than 10.
@Anthodpnt
Anthodpnt / random-array-node.js
Last active December 13, 2016 16:09
Math - Random Array Node
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <[email protected]>
* @site: https://www.twitter.com/JsGists
*
* The idea is to get a random node/entry from a given array.
*
* Example:
* I can't choose which fruit I'll eat this afternoon, they all look so tasty so I'll simply close my eyes
* and choose one of them randomly.