Skip to content

Instantly share code, notes, and snippets.

@lucacicada
lucacicada / tailwind.config.ts
Created May 8, 2024 13:38
Tailwindcss Shadcn Prose
import type { Config } from 'tailwindcss'
import typography from '@tailwindcss/typography'
export default <Partial<Config>>{
theme: {
extend: {
typography: {
DEFAULT: {
css: {
'--tw-prose-body': 'hsl(var(--foreground))',
@lucacicada
lucacicada / decimal-payload.ts
Last active June 6, 2023 20:39
Nuxt v3.5.0 Decimal.js payload plugin
// plugins/decimal-payload.ts
import { Decimal } from 'decimal.js'
export default definePayloadPlugin(() => {
definePayloadReducer('Decimal', data => Decimal.isDecimal(data) && data.toJSON())
definePayloadReviver('Decimal', data => new Decimal(data))
})
@lucacicada
lucacicada / ConsoleEx.cs
Created April 25, 2022 14:12
C# Console concurrent thread-safe write on the same line
namespace System;
using System.Text;
using System.Threading;
public static class ConsoleEx
{
/// <summary>
/// Keep track of concurrent writing.
/// </summary>
@lucacicada
lucacicada / DOM.js
Created April 18, 2022 20:54
Deno JSDOM 19.0.0 port
This file has been truncated, but you can view the full file.
var e$g,t$f,n$i,r$h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:global,o$f=e$g={};function i$e(){throw new Error("setTimeout has not been defined")}function u$e(){throw new Error("clearTimeout has not been defined")}function c$d(e){if(t$f===setTimeout)return setTimeout(e,0);if((t$f===i$e||!t$f)&&setTimeout)return t$f=setTimeout,setTimeout(e,0);try{return t$f(e,0)}catch(n){try{return t$f.call(null,e,0)}catch(n){return t$f.call(this||r$h,e,0)}}}!function(){try{t$f="function"==typeof setTimeout?setTimeout:i$e;}catch(e){t$f=i$e;}try{n$i="function"==typeof clearTimeout?clearTimeout:u$e;}catch(e){n$i=u$e;}}();var l$i,s$b=[],f$h=!1,a$f=-1;function h$b(){f$h&&l$i&&(f$h=!1,l$i.length?s$b=l$i.concat(s$b):a$f=-1,s$b.length&&d$9());}function d$9(){if(!f$h){var e=c$d(h$b);f$h=!0;for(var t=s$b.length;t;){for(l$i=s$b,s$b=[];++a$f<t;)l$i&&l$i[a$f].run();a$f=-1,t=s$b.length;}l$i=null,f$h=!1,function(e){if(n$i===clearTimeout)return clearTimeout(e);if((n$i===u$e||!n$i)&&clearTimeout)return n$i=clearT