Skip to content

Instantly share code, notes, and snippets.

View gokulkrishh's full-sized avatar

Gokulakrishnan Kalaikovan gokulkrishh

View GitHub Profile
// useful links:
// custom easing by Lochie (x.com/lochieaxon): https://www.easing.dev
// motion-primitives by Ibelick (x.com/Ibelick): https://motion-primitives.com/docs
// The Magic of Clip Path article by Emil Kowalski (x.com/emilkowalski_): https://emilkowal.ski/ui/the-magic-of-clip-path
// we use same transition for every element to make it look consistent
const transition: Transition = {
duration: 2.5,
// custom easing from https://www.easing.dev
ease: [0.175, 0.885, 0.32, 1],
@KristofferEriksson
KristofferEriksson / useGesture.ts
Created February 7, 2024 10:27
A custom React Typescript hook for advanced touch gestures in UI
import { useEffect, useRef } from "react";
type GestureType =
| "swipeUp"
| "swipeDown"
| "swipeLeft"
| "swipeRight"
| "tap"
| "pinch"
| "zoom";
@KristofferEriksson
KristofferEriksson / useBroadcastChannel.ts
Created February 5, 2024 09:20
A React hook that allows you to send and receive messages between browser tabs or windows
import { useCallback, useEffect, useRef, useState } from "react";
interface UseBroadcastChannelOptions {
name: string;
onMessage?: (event: MessageEvent) => void;
onMessageError?: (event: MessageEvent) => void;
}
interface UseBroadcastChannelReturn<D, P> {
isSupported: boolean;
@alekseykulikov
alekseykulikov / github-actions-ranking.md
Last active August 3, 2021 20:53
Github Actions Ranking (June 18, 2020)

Github Actions is a CI/CD platform that gained a lot of popularity recently. I participated in building ⭐️ Lighthouse CI Action and was curious how well it performs.

But Github Marketplace UI shows no ranking information. Essentially, It's a search with random results; at least, I don't understand the order. I couldn't find ⭐️ Lighthouse CI Action in Continuous integration category after browsing 50 available pages (Each page shows 20 results, so it's possible to see only 1000 results, but CI category has 1469 😐).

I decided to build a custom script that crawls all categories and use Github Search (example query) to estimate usa

export const h=(t,p,...c)=>({t,p,c,k:p&&p.key})
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=>
// arrays
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])):
// components
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=>
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):(
// create notes
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)),
// diff props
@willmendesneto
willmendesneto / a11y-dev-mode.css
Last active July 2, 2024 06:44
Using CSS for highlight errors in HTML - A11Y Linting HTML with CSS
/* Highliting accessibility errors in HTML */
/* highlight HTML element with invalid value for lang attribute */
html:not([lang]),
html[lang=""] {
border: 2px dotted red !important;
}
/* highlight images missing alt text */
img:not([alt]) {
@gokulkrishh
gokulkrishh / README.md
Last active January 27, 2020 04:24
How to debug/develop npm package

How to debug/develop npm package

Source

npm link

Destination

@gokulkrishh
gokulkrishh / useful-npx-commands.md
Last active April 10, 2025 17:31
List of useful npx (Node Package Runner) commands (https://git.io/useful-npx-commands)

NPX (NPM Package Runner) Commands

List of useful npx (NPM Package Runner) commands.

What is NPX?

Using NPX we can execute/run node binaries without the need to install it locally or globally.

Commands

/* Helper buddy for removing async/await try/catch litter 🗑 */
function O_o(promise) {
return promise.then(data => {
if (data instanceof Error) return [data]
return [null, data]
}).catch(err => [err])
}
/* Look ma, no try/catch */
async function usageExample(params) {
@rviscomi
rviscomi / CrashCourseInCrUX.md
Last active October 8, 2024 18:14
"Crash Course in CrUX" for the PerfMatters conference, April 2019