Skip to content

Instantly share code, notes, and snippets.

@eemeli
eemeli / index.html
Created February 15, 2022 07:05
Minimal reproduction for Vite bug with build.rollupOptions.external & <link rel="stylesheet">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="/style.css" />
</head>
<body>
<div id="app"></div>
<script type="module" src="/main.js"></script>
</body>
@eemeli
eemeli / yaml-doc-stream.js
Created February 13, 2021 22:20
yaml@2 Node.js Transform stream implementation
import { Transform } from 'stream'
import { StringDecoder } from 'string_decoder'
import { Composer, Parser } from 'yaml'
/**
* A Transform stream that accepts either strings or Buffers as input, and
* emits YAML Documents.
*
* Calling the stream's `end()` method may be required to emit the last
* document.
@eemeli
eemeli / index.ts
Created January 4, 2021 11:19
Minimal repro for TypeStrong/typedoc#1449
export function fails<T extends [foo: any, bar?: any]>(a: T): T {
return a;
}
@eemeli
eemeli / use-full-import-file-paths.js
Created May 3, 2020 20:30
A jscodeshift codemod for replacing import & export paths with their full paths, including extensions. Effectively fixes imports for use as ES modules in Node.js.
/**
* A jscodeshift codemod for replacing import & export paths with their full
* paths, including extensions. Effectively fixes imports for use as ES modules
* in Node.js.
*
* Copyright Eemeli Aro <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
*/
@eemeli
eemeli / events.sql
Created October 5, 2018 19:48
Kansa events schema (draft)
-- Places for events to happen in
CREATE TABLE spaces (
space_id SERIAL PRIMARY KEY,
parent_id integer REFERENCES spaces,
name text NOT NULL,
description text,
size integer
);
-- Things that events may need, possibly attached to specific spaces

Keybase proof

I hereby claim:

  • I am eemeli on github.
  • I am eemeli (https://keybase.io/eemeli) on keybase.
  • I have a public key whose fingerprint is CB8F EEFA 5045 BA5A ED04 3EC5 82CB D8E5 2D60 E14A

To claim this, I am signing this object:

@eemeli
eemeli / make release
Last active August 29, 2015 14:17
GNU make rules to release a new version of an npm project with a Github repo, resulting in an off-tree tagged release containing generated files. Includes checks to make sure releases are only made from a clean working tree that matches the current Github HEAD of the project. License: ISC.
# Copyright (c) 2015 by Eemeli Aro <[email protected]>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# The software is provided "as is" and the author disclaims all warranties
# with regard to this software including all implied warranties of
# merchantability and fitness. In no event shall the author be liable for
# any special, direct, indirect, or consequential damages or any damages
@eemeli
eemeli / en.json
Last active August 29, 2015 13:56
Sample MessageFormat JSON for testing messageformat.js output
{
"weekday_n":"{N, plural, =0{Sunday} =1{Monday} =2{Tuesday} =3{Wednesday} =4{Thursday} =5{Friday} =6{Saturday} other{???}}",
"month_n":"{N, plural, =0{January} =1{February} =2{March} =3{April} =4{May} =5{June} =6{July} =7{August} =8{September} =9{October} =10{November} =11{December} other{???}}",
"time_diff":"{T} {T_UNIT, plural, =0{seconds} =1{minutes} =2{hours} =3{days} =4{weeks} =5{months} =6{years} other{???}} {T_PAST, select, true{ago} other{from now}}",
"no_id":"No ID set! Please assign konopas_set.id a unique identifier.",
"old_browser":"Unfortunately, your browser doesn't support some of the Javascript features required by KonOpas. To use, please try a different browser.",
"private_mode":"It looks like you're using an iOS or Safari browser in private mode, which disables localStorage. This will result in a suboptimal KonOpas experience.",
"next_ended":"There are no more program items scheduled.",
"next_start":"The next program item starts in {H, plural, =0{} one{one hour and} other{# hours and}} {M,