Skip to content

Instantly share code, notes, and snippets.

View hasparus's full-sized avatar

Piotr Monwid-Olechnowicz hasparus

View GitHub Profile
@hasparus
hasparus / README.md
Last active August 19, 2024 18:34
A color scheme for Windows Terminal

👨‍🎤 Cyberpunk SCARLET for Windows Terminal

screenshot of terminal presenting colors and borg cowsay saying "Hello!"

profile settings in screenshot

  "colorScheme": "Cyberpunk SCARLET",
  "cursorHeight": 25,
 "cursorShape": "vintage",
@hasparus
hasparus / windows-auto-darkmode.ps1
Last active April 20, 2024 17:39
A PowerShell script setting light mode during the day and dark mode after 18:30.
# Set your triggers to 06:00, log in, and 18:30.
# Set this to false if you like light Windows UI.
# Personally, I'm conflicted so I change it back and forth every few months.
$SYSTEM_ALWAYS_DARK = $TRUE
$lightTheme = @{ AppsUseLightTheme = 1; SystemUsesLightTheme = 1 }
$darkTheme = @{ AppsUseLightTheme = 0; SystemUsesLightTheme = 0 }
# We set light mode between 06:00 and 18:30.
@hasparus
hasparus / @changesets__assemble-release-plan@5.2.3.patch
Last active August 31, 2023 13:06
a bit wasteful CI/CD setup with PR snapshot release and automerged Changesets on main
diff --git a/dist/assemble-release-plan.cjs.dev.js b/dist/assemble-release-plan.cjs.dev.js
index 3a37c62c975518f975c22e1b4b3974d9b325a5da..cc7b4669526b9ccddcf184f52f8cb5225cc8284e 100644
--- a/dist/assemble-release-plan.cjs.dev.js
+++ b/dist/assemble-release-plan.cjs.dev.js
@@ -132,16 +132,38 @@ function determineDependents({
} of dependencyVersionRanges) {
if (nextRelease.type === "none") {
continue;
- } else if (shouldBumpMajor({
- dependent,
import { ReactRenderer, StoryObj } from '@storybook/react'
import { ComponentAnnotations } from '@storybook/types'
import { describeStories } from './tiniest-storybook-test-suites'
import * as stories from './MyComponent.stories'
describeStories(stories)
// @ts-ignore
import GatsbyParser from "gatsby/dist/query/file-parser";
import path from "path";
import glob from "glob";
/**
* Collect all graphql fragments from a directory
* @see https://github.com/gatsbyjs/gatsby/issues/12155#issuecomment-618424527
*/
export const collectGraphQLFragments = async (
// TypeScript Playground: https://tsplay.dev/mq8eYN
/// <reference types="@types/jest" />
import type { MatcherState } from 'expect';
const matchers = {
toHaveWordsCount(this: MatcherState, sentence: string, wordsCount: number) {
// implementation redacted
},
@hasparus
hasparus / match.ts
Last active August 15, 2022 01:30
lightweight sum type matching in typescript
interface A { type: 'A', a: 10 };
interface B { type: 'B', b: [11] };
type AB = A | B;
type TypeOf<T extends { type: any }> = T extends { type: infer Type } ? Type : never;
type Cases<T extends { type: any }, R> = {
[P in TypeOf<T>]: (val: Extract<T, { type: P }>) => R
}
@hasparus
hasparus / Microsoft.Powershell_profile.ps1
Last active May 26, 2022 17:13
A guide on setting up on new laptops for future me, and a manifest of all the tools I installed.
# Git Completions
Import-Module posh-git
# Prompt
Invoke-Expression (&starship init powershell)
# Aliases
Set-Alias g git
# Utils