Skip to content

Instantly share code, notes, and snippets.

View designerzen's full-sized avatar

zen designerzen

View GitHub Profile
@jh3y
jh3y / gsap-eases.css
Last active January 29, 2024 18:27
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
@shawwn
shawwn / syncscroll
Created April 1, 2021 03:24
Synchronized scrolling (and zooming) across browser tabs
javascript:(function()%7Bwindow.addEventListener(%20'scroll'%2C%20(e)%20%3D%3E%20%7B%20localStorage.setItem('scrollY'%2C%20scrollY)%3B%20localStorage.setItem('zoom'%2C%20document.body.style.zoom)%3B%20%7D%20)%3Bwindow.addEventListener(%20'storage'%2C%20(e)%20%3D%3E%20%7B%20if%20(e.key%20%3D%3D%3D%20%22scrollY%22)%20%7B%20y%3DparseInt(e.newValue)%3B%20window.scrollTo(0%2C%20y)%3B%20%7D%3B%20if%20(e.key%20%3D%3D%3D%20%22zoom%22)%20%7B%20document.body.style.zoom%3De.newValue%3B%20%7D%3B%20%7D%20)%7D)()
//MIT License
//Copyright (c) 2021 Felix Westin
//Source: https://github.com/Fewes/MinimalAtmosphere
//Ported to GLSL by Marcin Ignac
#ifndef ATMOSPHERE_INCLUDED
#define ATMOSPHERE_INCLUDED
// -------------------------------------
@troyhunt
troyhunt / rick-roll-content-scraper.js
Created August 19, 2020 07:41
A Cloudflare worker to redirect image requests from dickhead content scraper's site to a Rick Roll
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
async function fetchAndApply(request) {
let response = await fetch(request)
let referer = request.headers.get('Referer')
let contentType = response.headers.get('Content-Type') || ''
if (referer && contentType.startsWith('image/')) {
@craigcarlyle
craigcarlyle / a11y-linter.ts
Last active July 16, 2021 18:56
Cypress Accessibility Linter
function a11yLinter(tagName: string) {
return cy.window().then((win: any) => {
return new Cypress.Promise(function(resolve: any, reject: any) {
win.axe.run(tagName, (err: any, results: any) => {
if (err) {
reject(err);
}
resolve(results.violations);
});
});
@sarthology
sarthology / regexCheatsheet.js
Created January 10, 2019 07:54
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@gbaman
gbaman / HowToOTGFast.md
Last active April 16, 2024 06:29
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@enriched
enriched / jsonSchemaInterface.ts
Last active December 8, 2023 07:28
TypeScript interface for Json-Schema V4
/**
* MIT License
*
* Copyright (c) 2016 Richard Adams (https://github.com/enriched)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@plugnburn
plugnburn / 999.css
Last active March 16, 2017 00:05
999.css - a 999-byte barebones CSS framework
*{box-sizing:border-box;outline:none}
html {font-size:17px;font-family:Roboto,arial,sans-serif}
code,pre{
font-size:0.9rem;font-family:"Droid Sans Mono",monospace;
word-wrap:break-word;
}
body {margin:0;padding:0;font-size:1rem;line-height:1.375}
body,th,td,input,textarea,select,option,h1,h2,h3,h4,.fbox,.fr,.fr>*{
font-size-adjust:0.5;
font-family:inherit;

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.