Skip to content

Instantly share code, notes, and snippets.

View auduongtuan's full-sized avatar

Au Duong Tuan auduongtuan

View GitHub Profile
@anLpk
anLpk / helpers.ts
Last active November 9, 2025 22:19
MiddleTruncate component
export const measureText = (container: HTMLElement) => {
const span = document.createElement('span');
span.style.opacity = '0';
span.style.position = 'absolute';
span.style.top = '-1000px';
span.style.left = '-1000px';
span.style.whiteSpace = 'nowrap';
span.style.pointerEvents = 'none';
container.appendChild(span);
@svallory
svallory / README.md
Created October 25, 2021 00:26
Figma Plugin Development Live Reload

Figma Plugin Development Live Reload

  1. Create a run-plugin.sh somewhere in your project
  2. Copy the code from the run-plugin.sh file in this gist
  3. Install nodemon with yarn add --dev nodemon
  4. Add a script in the scripts property of your package.json replacing PLUGIN_CODE_FOLDER by the path to the folder where your plugin code lives
    "scripts": {
    

"livereload": "nodemon --watch PLUGIN_CODE_FOLDER --exec run-plugin.sh"

@jordansinger
jordansinger / lil-dice.tsx
Created October 19, 2021 19:43
lil dice FigJam widget
const { widget } = figma
const { Rectangle, AutoLayout, Frame, Text, useSyncedState, usePropertyMenu, useEffect, Ellipse } = widget
function Dot(props) {
let visible = props.visible
return (
<Ellipse
opacity={visible ? 1 : 0}
width={24}
height={24}