Skip to content

Instantly share code, notes, and snippets.

@DonAmit197
DonAmit197 / gist:dc0d6696c1dc940d54787e2953c08e72
Created June 20, 2025 09:10 — forked from BjornDCode/gist:5cb836a6b23638d6d02f5cb6ed59a04a
Tailwind - Fixed sidebar, scrollable content
// Source: https://twitter.com/calebporzio/status/1151876736931549185
<div class="flex">
<aside class="h-screen sticky top-0">
// Fixed Sidebar
</aside>
<main>
// Content
</main>

Unicode cheat sheet

A curated list of unicode characters I want to have quick reference toward, including their literal presentation (where possible), description from the unicode table, various representations, and how to enter it as a Vim digraph*.

They are grouped by category, including a link to the relevant Unicode block. Also see the full list of Unicode blocks

@DonAmit197
DonAmit197 / detect-autofill.js
Created May 21, 2025 23:12 — forked from jonathantneal/detect-autofill.js
Detect autofill in Chrome, Edge, Firefox, and Safari
export default scope => {
// match the filter on autofilled elements in Firefox
const mozFilterMatch = /^grayscale\(.+\) brightness\((1)?.*\) contrast\(.+\) invert\(.+\) sepia\(.+\) saturate\(.+\)$/
scope.addEventListener('animationstart', onAnimationStart)
scope.addEventListener('input', onInput)
scope.addEventListener('transitionstart', onTransitionStart)
function onAnimationStart(event) {
// detect autofills in Chrome and Safari by:
function getHightlightCoords() {
var pageIndex = PDFViewerApplication.pdfViewer.currentPageNumber - 1;
var page = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
var pageRect = page.canvas.getClientRects()[0];
var selectionRects = window.getSelection().getRangeAt(0).getClientRects();
var viewport = page.viewport;
var selected = selectionRects.map(function (r) {
return viewport.convertToPdfPoint(r.left - pageRect.x, r.top - pageRect.y).concat(
viewport.convertToPdfPoint(r.right - pageRect.x, r.bottom - pageRect.y));
});
@DonAmit197
DonAmit197 / productSchool.js
Created April 17, 2025 11:28 — forked from ak--47/productSchool.js
💾 data loader for the Product Analytics Certification
//PUT YOUR MIXPANEL TOKEN AND SECRET BELOW:
const credentials = {
"token": "your-mixpanel-token-here",
"secret": "your-mixpanel-secret-here"
}
/*
@DonAmit197
DonAmit197 / react-lifting-up-state.js
Last active December 30, 2023 12:01
Based on Jonas React Tutorial lifting up state
import { useState } from 'react';
const initialItems = [
{ id: 1, description: 'Passports', quantity: 2, packed: false },
{ id: 2, description: 'Socks', quantity: 12, packed: true },
{ id: 3, description: 'Charger', quantity: 1, packed: false },
];
export default function App() {
const [items, setItems] = useState([]);
@DonAmit197
DonAmit197 / js
Last active July 3, 2023 00:25
promise hell
/****
* Server side PDF generation plugin.
*Scenario:
* Promise based
* It fetches the HTML content on a button click
* htmlComponentCreate method : Instatiating the Promise API
* It fetches the value of the user input from the form.submission JSON for "textfield", "select", "day","number", "textarea","datetime","currency","phoneNumber"
* For nzPost address: When it finds the custom property data_zapostAddress === "true" in the form JSON as a custom property
* then method : Method when the Promise is resolved or rejected, if the form is validated
* you can also use a callback function inside the then method
/*******
The purpose of this function is to flatten the Nested or tree structure JSON data
******/
var flatten = (function (isArray, wrapped) {
return function (table) {
return reduce("", {}, table);
};
function reduce(path, accumulator, table) {