Skip to content

Instantly share code, notes, and snippets.

View eonist's full-sized avatar
🎯
Focusing

André J eonist

🎯
Focusing
View GitHub Profile
@eonist
eonist / store2.md
Created June 8, 2025 22:37
store2.md

Yes, Figma plugins have their own dedicated local storage system called figma.clientStorage, which is specifically designed for plugin data persistence[1].

How Figma Plugin Storage Works

Plugin-Specific Storage: Each plugin gets its own isolated storage space that other plugins cannot access[1]. The data is specific to your plugin ID, ensuring complete separation between different plugins[1].

Storage Capacity: Each plugin receives 5MB of total storage space[1]. You can estimate usage by adding the size of keys plus their JSON-converted values[1].

Asynchronous API: Unlike regular localStorage, Figma's clientStorage uses asynchronous methods[1]:

  • figma.clientStorage.setAsync(key, value) - Store data
@eonist
eonist / store.md
Last active June 8, 2025 22:35
store.md

Yes, Figma plugins have several mechanisms for storing cached data:

Client Storage API

Figma provides the figma.clientStorage API specifically designed for plugins to store data on the user's local machine. This storage mechanism:

  • Allows storing up to 5MB of data per plugin[2]
  • Supports storing various data types including objects, arrays, strings, numbers, booleans, null, undefined, and Uint8Array[2]
  • Is asynchronous and provides methods like getAsync(), setAsync(), deleteAsync(), and keysAsync()[2]
  • Is specific to your plugin ID, meaning other plugins cannot access this data[2]
@eonist
eonist / Resize plugin based on content .md
Created June 8, 2025 20:40
Resize plugin based on content

Based on the provided search results, there isn't specific information about making a Figma plugin's UI height automatically adjust to its content. The search results primarily focus on auto-layout and resizing behaviors within Figma designs themselves rather than plugin UI development.

However, I can provide some guidance on this topic: In Figma plugin development, the plugin UI (which runs in an iframe) doesn't automatically "hug" content like auto-layout frames do within Figma designs. You'll need to programmatically manage the plugin's dimensions.

Approaches for Dynamic Plugin Height

Manual Resize Method You can calculate your content height and resize the plugin window accordingly using the figma.ui.resize() method:

@eonist
eonist / htmlstructure.md
Created June 8, 2025 14:48
htmlstructure.md

which solution would you go for with these requirments: our built files only consist of 1 ui.html and 1 code.js

Given your constraint of having only 1 ui.html and 1 code.js file, the Show/Hide with CSS Classes Approach is your best option. The search results support this recommendation, as they indicate that having a single JS file can be appropriate for smaller applications[^1], and that external JS files are better for testing and development[^3].

Recommended Solution Structure

ui.html:

@eonist
eonist / Build research.md
Last active June 7, 2025 15:21
Build research.md

You're correct that Figma plugins have strict file constraints - they can only accept a single JavaScript file and a single HTML file, with no ability to load external files[10]. Here are the main approaches to bundle TypeScript, CSS, and HTML files into the required single-file format:

Webpack with TypeScript

Webpack is the most commonly recommended solution for Figma plugin bundling[1]. Here's how to set it up:

Install dependencies:

npm install --save-dev typescript ts-loader webpack webpack-cli
npm install --save-dev html-webpack-plugin style-loader css-loader
@eonist
eonist / typescript_best_practice.md
Created June 7, 2025 12:07
typescript_best_practice

Type System and Safety

Use proper primitive types Always use lowercase primitive types (number, string, boolean, symbol) instead of their capitalized boxed object counterparts (Number, String, Boolean, Symbol, Object)[1]. Use object instead of Object for non-primitive types[1].

Avoid any, prefer unknown The any type defeats TypeScript's purpose by bypassing type checking[4][6][7]. When the type is uncertain, use unknown instead, which requires type-checking before operations can be performed[4][7].

Enable strict typing Set "strict": true in your tsconfig.json and consider additional options like "noImplicitAny" and "strictNullChecks"[4]. This reveals hidden bugs and makes your codebase more reliable[4].

@eonist
eonist / gemini 300$ free token rate limit.md
Created June 4, 2025 17:01
gemini 300$ free token rate limit

If you add your credit card to Google Gemini and receive the $300 in free tokens (Google Cloud credits), there are still rate limits on your usage, even during the free trial period.

Rate Limits with $300 Free Credits

  • API Rate Limits: Google enforces rate limits on the Gemini API to ensure fair usage and system stability. These limits are measured in several ways:
    • Requests per minute (RPM)
    • Requests per day (RPD)
    • Tokens per minute (TPM)
    • Tokens per day (TPD)
@eonist
eonist / Zero-taxation-dillema.md
Last active June 9, 2025 15:39
Zero taxation dillema

Q: in norway do you have to pay tax if you buy shares with capital from a company

Taxation of Share Purchases Using Company Capital in Norway

Buying Shares With Company Capital (Corporate Investments)

If you are buying shares using capital from a Norwegian company (such as an Aksjeselskap or AS), the tax treatment is very different from that of a private individual:

  • Norwegian companies benefit from the "participation exemption method" (fritaksmetoden), which means that capital gains and dividends from qualifying shares are generally tax-exempt at the company level. This applies to most shares in both Norwegian and EEA companies, provided certain requirements are met[9][11].
  • Exception: 3% of dividends received by a company are taxable at the standard corporate tax rate (22%), resulting in an effective tax rate of 0.66% on dividends. However, capital gains from the sale of shares are typically fully exempt from tax for the company[11].
@eonist
eonist / Crowdfunding Card in Figma.md
Created May 31, 2025 21:29
Crowdfunding Card in Figma

Here's a step-by-step Figma design prompt for creating a crowdfunding card interface:

🎨 Build a Crowdfunding Card in Figma

Step 1: Create the Main Container Create a 400px wide frame with dark background (#1A1A1A), 24px padding, and vertical auto-layout with 20px spacing[1].

Step 2: Add Progress Section Build a rounded container (16px radius) with gray border. Add vertical layout with 16px padding for the progress elements[1].

@eonist
eonist / Cline VS Cursor.md
Last active May 31, 2025 18:14
Cline VS Cursor

Cline offers several key advantages over Cursor that make it appealing to certain developers, particularly those who value transparency, flexibility, and cost control.

Cost Structure and Flexibility

Cline operates on a pay-per-token model using your own API keys, which can be significantly more cost-effective for users with varying usage patterns. Unlike Cursor's fixed $20/month subscription with limited requests (500 for the Pro Plan), Cline allows you to pay only for what you use[1][5]. This approach gives developers complete control over their spending and can be particularly beneficial for those who don't need consistent daily usage.

Model Selection and Performance

One of Cline's most significant advantages is its model flexibility. Cline integrates with OpenRouter and allows you to choose from various AI models, including Claude 3.5 Sonnet, Qwen 2.5 Coder 32B, and other cutting-edge models[2]. This flexibility means you can access superior models since you're paying for actu