Skip to content

Instantly share code, notes, and snippets.

@khalidx
khalidx / node-typescript-esm.md
Last active June 13, 2024 12:39
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

{% comment %}
Firstly, we can't comment inside liquid tags, so this turned into a mess pretty quickly.
In order to somewhat document this mess, I'll do my best without writing the comments inline :(
This snippet takes in a string variable called "raw", parses it for markdown, and spits out the
corresponding HTML representation
@RedHatter
RedHatter / ButtonGroup.svelte
Created February 11, 2021 05:29
Svelte form and input components with buildt-in validation
<script>
import { onMount, createEventDispatcher } from 'svelte'
import { getContext } from './Form.svelte'
const dispatch = createEventDispatcher()
export let value = ''
export let options = {}
let className
export { className as class }
@antony
antony / build.js
Last active March 11, 2021 01:45
custom-feather-icons
const feather = require('feather-icons/dist/icons.json')
const pascal = require('just-pascal-case')
const { promises: fs } = require('fs')
const { join } = require('path')
const iconList = require('./icon-list.json')
const handleComponentName = name => name.replace(/\-(\d+)/, '$1')
const component = icon =>
`<script>
@senderle
senderle / hand-modify-pdf.md
Created September 23, 2020 15:03
So you want to modify the text of a PDF by hand

So you want to modify the text of a PDF by hand...

If you, like me, resent every dollar spent on commercial PDF tools, you might want to know how to change the text content of a PDF without having to pay for Adobe Acrobat or another PDF tool. I didn't see an obvious open-source tool that lets you dig into PDF internals, but I did discover a few useful facts about how PDFs are structured that I think may prove useful to others (or myself) in the future. They are recorded here. They are surely not universally applicable --
the PDF standard is truly Byzantine -- but they worked for my case.

@aleclarson
aleclarson / rollup-typescript.md
Last active June 21, 2024 03:25
The best Rollup config for TypeScript libraries

Features

🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs bundle
.d.ts bundle + type-checking
🧐 Source maps

Install

@klevu
klevu / query-1
Last active February 12, 2024 12:00
Shopify Metafields with GraphQL
{
product(first: 50) {
edges {
node {
name
description
}
}
}
}
@lukaskleinschmidt
lukaskleinschmidt / app.scss
Last active September 11, 2023 14:50
Utility class generator like tailwindcss but in pure Sass.
@use 'sass:map';
@use 'variants' as * with (
$breakpoints: (
'small': 640px,
'medium': 768px,
'large': 1024px,
'wide': 1280px,
)
);
import { writable, get } from 'svelte/store';
function makeBroadcastChannelSharedStore(name) {
let channel;
let receivedInitialValue = false;
function sendMessage(action, value = null) {
if (channel) {
channel.postMessage({ action, value });
}
// please check https://docs.netlify.com/configure-builds/environment-variables/#declare-variables for most up to date info
// this was created before those docs existed
process.env = {
/**
*
* AUTOMATICALLY SET BY NETLIFY. IMMUTABLE!
* docs: https://www.netlify.com/docs/continuous-deployment/#environment-variables
*
*/