Skip to content

Instantly share code, notes, and snippets.

@drmikecrowe
drmikecrowe / install.sh
Created June 28, 2023 08:56 — forked from mx00s/install.sh
NixOS install script based on @grahamc's "Erase Your Darlings" blog post
#!/usr/bin/env bash
#
# NixOS install script synthesized from:
#
# - Erase Your Darlings (https://grahamc.com/blog/erase-your-darlings)
# - ZFS Datasets for NixOS (https://grahamc.com/blog/nixos-on-zfs)
# - NixOS Manual (https://nixos.org/nixos/manual/)
#
# It expects the name of the block device (e.g. 'sda') to partition
TS2344: Type 'T[U]' does not satisfy the constraint '(...args: any) => any'.
Type 'T[OnlyFunctionPropertyNames<T>]' is not assignable to type '(...args: any) => any'.
Type 'T[T[keyof T] extends (...args: any) => any ? keyof T : never]' is not assignable to type '(...args: any) => any'.
Type 'T[keyof T]' is not assignable to type '(...args: any) => any'.
Type 'T[string] | T[number] | T[symbol]' is not assignable to type '(...args: any) => any'.
Type 'T[string]' is not assignable to type '(...args: any) => any'.
16 | T extends Composer<never>,
17 | U extends OnlyFunctionPropertyNames<T> = OnlyFunctionPropertyNames<T>,
> 18 | > = Filter<Parameters<T[U]>, Middleware<never>>
@drmikecrowe
drmikecrowe / README.md
Last active February 1, 2024 18:02
My journaling template

I created the journals object that links a tag to a nested folder for all my journals. There are multiple issues this solves:

  • Journaling across multiple clients in different folders
  • Clicking on a link to a new journal entry that doesn't exist (see breadcrumb nested folder)
  • Client tagging

In the previous/next links, my link format is:

<< [[<% tag %>-<% tp.date.now("YYYY-MM-DD", -1) %>]] | [[<% tag %>-<% tp.date.now("YYYY-MM-DD", 1) %>]] >>
@drmikecrowe
drmikecrowe / launches.json
Last active March 4, 2022 12:14
My common launch.json config
[
{
"type": "node",
"request": "attach",
"port": 9229,
"sourceMaps": true,
"name": "Attach 9229",
"cwd": "${workspaceRoot}",
"address": "localhost",
"localRoot": "${workspaceFolder}",
@drmikecrowe
drmikecrowe / machine.js
Created September 17, 2020 09:04
Generated by XState Viz: https://xstate.js.org/viz
const machine = Machine({
id: "formModal",
initial: "closed",
states: {
closed: {
on: {
OPEN: "opened"
}
},
@drmikecrowe
drmikecrowe / machine.js
Last active September 17, 2020 01:24
Generated by XState Viz: https://xstate.js.org/viz
const PMachineOptions = {
guards: {
IS_FETCH_NEEDED: function (ctx) {
return !ctx.podcast.loaded;
},
IS_FETCHED_ALREADY: function (ctx) {
return ctx.podcast.loaded;
},
IS_SUBSCRIBE_NEEDED: function (ctx) {
return !ctx.currentDevice.isSubscribed(ctx.podcast);
@drmikecrowe
drmikecrowe / machine.js
Last active July 5, 2020 21:34
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@drmikecrowe
drmikecrowe / machine.js
Last active July 5, 2020 11:16
Generated by XState Viz: https://xstate.js.org/viz
const states = {
IDLE: 'IDLE',
SEARCHING: 'SEARCHING',
};
const searchNotEmptyTarget = {
target: states.SEARCHING,
cond: (_ctx, evt) => evt.search !== '', // && evt.search.length > 3,
actions: assign({ search: (_ctx, evt) => evt.search }),
};
@drmikecrowe
drmikecrowe / index.d.ts
Created May 31, 2020 13:31
cache-manager index.d.ts types
declare module 'cache-manager/caching' {
/**
* Generic caching interface that wraps any caching library with a compatible interface.
* @param args.store - The store must at least have `set` and a `get` functions.
* @param [args.isCacheableValue] - A callback function which is called
* with every value returned from cache or from a wrapped function. This lets you specify
* which values should and should not be cached. If the function returns true, it will be
* stored in cache. By default it caches everything except undefined.
*/
function caching(args: {
@drmikecrowe
drmikecrowe / index.d.ts
Created May 30, 2020 12:28
index.d.ts for cache-manager
/**
* Instead of manually managing the cache like this:
* function getCachedUserManually(id, cb) {
* memoryCache.get(id, function(err, result) {
* if (err) { return cb(err); }
*
* if (result) {
* return cb(null, result);
* }
*