Skip to content

Instantly share code, notes, and snippets.

View danieldietrich's full-sized avatar
💭
📡 working from space

Daniel Dietrich danieldietrich

💭
📡 working from space
View GitHub Profile
@danieldietrich
danieldietrich / README.md
Last active February 14, 2024 13:15
The easiest way to bundle a simple TypeScript web application

THIS README IS OUTDATED AND UNMAINTAINED - PLEASE DON'T RELY ON THIS

The easiest way to bundle a simple TypeScript web application

Packaging JavaScript applications can be a bit overwhelming. The popular project uglifyjs does not support ES6, it is cumbersome to configure the allmighty Webpack, bundlers like Parcel and Microbundle still have bugs or do not compile to ESM bundles that work in a browser. It is hard to figure out the best way to bundle an application.

Here I give a small example, how we achieve the goal using the

@danieldietrich
danieldietrich / gist:55b4f08fbe2720ea89954b216418d4ff
Created December 1, 2023 15:15 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@danieldietrich
danieldietrich / LLM.md
Created March 30, 2023 20:39 — forked from rain-1/LLM.md
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@danieldietrich
danieldietrich / launch.json
Created October 26, 2022 15:29
Langium Launch configuration
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
@danieldietrich
danieldietrich / thoughts.md
Last active October 18, 2022 12:48
The case of IsEmpty<T> versus universal types any, unknown and never

IsEmpty<T>

A value of type T is defined to be empty, if

  • it is an array and has no elements
  • it is an object and has no properties

Handling of universal types

  • any can be seen as the union of all types. A union distributes in conditional types, so any may or may not be empty. true | false = boolean
@danieldietrich
danieldietrich / attributions.md
Last active October 7, 2022 02:33
Traverse the type of an object tree, find leafs that are function types and collect the type of their first argument.
@danieldietrich
danieldietrich / 01_definition.md
Last active September 27, 2022 20:20
TypeScript: Conditional types are distributive over type parameters.

Def. A conditional type with a checked naked type parameter T is called distributive conditional types.

Example:

// given U, X and Y
type DistributiveConditionalType<T> = T extends U ? X : Y;

Distributive conditional types are automatically distributed over union types during instantiation.

@danieldietrich
danieldietrich / README.md
Last active September 25, 2022 21:10
Deeply merging JavaScript objects

Deeply merging JavaScript objects

This method is like Object.assign except that it recursively merges own enumerable string keyed properties of source objects into the destination object. Source properties that resolve to undefined are skipped if a destination value exists. Arrays are concatenated. Plain object properties are merged recursively. Other objects and value types are overridden by assignment. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.

Note: This method mutates target.

Motivation

  • The native Object.assign does simply overwrite values on duplicate keys.
  • The Lodash _.merge does not handle arrays the way I would expect it:
@danieldietrich
danieldietrich / print256colours.sh
Created December 9, 2021 12:56 — forked from HaleTom/print256colours.sh
Print a 256-colour test pattern in the terminal
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256
@danieldietrich
danieldietrich / .bashrc
Last active December 11, 2021 05:44
Git prompt for shell
#
# Usage: `source <(curl -sL https://bashrc.danieldietrich.dev)`
#
export LANG=en_US.UTF-8
export LC_ALL=${LANG}
export TERM=xterm-256color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx