Skip to content

Instantly share code, notes, and snippets.

View brokenthorn's full-sized avatar
🏠
Working from home

Paul-Sebastian Manole brokenthorn

🏠
Working from home
View GitHub Profile
@brokenthorn
brokenthorn / effect-clearAllLoggers.ts
Last active February 11, 2025 19:54
Effect: Clear all Loggers
import { Effect, FiberRef, HashSet, Layer } from "effect";
/**
* A Layer that clears all existing `Logger`s.
*
* @example
* import { NodeRuntime } from "@effect/platform-node"
* import { Effect, FiberRef, HashSet, Layer, Logger } from "effect"
*
* const MainLayer = Logger.json.pipe(Layer.provide(ClearAllLoggersLayer))
@brokenthorn
brokenthorn / delete_node_modules_folders_recursively.ps1
Last active November 15, 2024 13:26
Delete all node_modules folders recursively from current folder (or any other folder if you change the folder name)
# Recursively search for directories named "node_modules"
Get-ChildItem -Recurse -Directory -Filter "node_modules" | ForEach-Object {
# Check if the directory name is exactly "node_modules"
if ($_.Name -eq "node_modules" -and $_.FullName -notmatch "node_modules.*\\node_modules") {
# Output the path of the directory being deleted
Write-Output "Deleting: $($_.FullName)"
# Use the 'rd' command via cmd.exe to delete the directory quietly and efficiently
# /s: Removes all files and subdirectories
# /q: Suppresses confirmation prompts
cmd.exe /c "rd /s /q `"$($_.FullName)`""
@brokenthorn
brokenthorn / settings.json
Last active August 21, 2023 09:02
My VS Code Settings 05.05.2023
{
"editor.fontFamily": "'JetBrains Mono', 'Cascadia Code', Consolas, 'Courier New', monospace",
"editor.fontSize": 18,
"editor.fontWeight": "200",
"editor.lineHeight": 1.66,
"terminal.integrated.fontFamily": "'JetBrains Mono', 'Cascadia Code', Consolas, 'Courier New', monospace",
"terminal.integrated.fontSize": 14,
"terminal.integrated.fontWeight": "300",
@brokenthorn
brokenthorn / filter-by.pipe.ts
Created July 21, 2021 16:03
Angular Pipe Snippet for Recursive Filter Object Properties By Term with optional limit to a single property
import {Injectable, Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'filterBy',
pure: true
})
@Injectable()
export class FilterByPipe implements PipeTransform {
/**
@brokenthorn
brokenthorn / SqlDataReader_To_CSV_Using_CsvHelper_Library.cs
Created July 11, 2021 00:29
In this C# Gist, a CsvHelper.CsvWriter is used to asynchronously write the results of a SQL query to a CSV file without worrying about each column's data type.
try
{
await using var sqlDataReader = await sqlCommand.ExecuteReaderAsync(cancellationToken);
await using var streamWriter = new StreamWriter($"{reportName}_{startDate:dd-MM-yyyy}-{endDate:dd-MM-yyyy}.csv");
await using var csvWriter = new CsvWriter(streamWriter, _csvConfiguration);
var columnSchema = sqlDataReader.GetColumnSchema();
var columnCount = columnSchema.Count;
// write headers to CSV:
@brokenthorn
brokenthorn / patch-edit.rb
Created February 22, 2021 08:52
Create display override file to force Mac OS X to use RGB mode for External Displays
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for External Displays
# see http://embdev.net/topic/284710
#
# Update 2013-06-24: added -w0 option to prevent truncated lines
# Copy the folder that appears to sudo mkdir -p /Library/Displays/Contents/Resources/Overrides
require 'base64'
@brokenthorn
brokenthorn / Link.tsx
Created September 29, 2020 11:44
Partially converted TSX version of Material UI wraper for Next.js Link component
@brokenthorn
brokenthorn / WIP Schema.sql
Created September 21, 2020 19:26
WIP Schema
-- Start Migrations
-- Migration 20200921191728-mig-1
CREATE TABLE "public"."User" (
"id" SERIAL,
"email" text NOT NULL ,
"firstName" text NOT NULL ,
"middleName" text ,
"lastName" text NOT NULL ,
PRIMARY KEY ("id")
@brokenthorn
brokenthorn / README.md
Last active September 14, 2020 14:54
Restartable debugging for TypeScript within Visual Studio Code (vscode) using nodemon and ts-node

Info

Inspiration was taken from Eduardo Rabelo - https://eduardorabelo.me - from this article: https://dev.to/oieduardorabelo/nodejs-with-typescript-debug-inside-vscode-and-nodemon-23o7

To start debugging, you need to first start the dev:debug npm script with npm run dev:debug, then run the Node: Nodemon launch configuration from VSCode, in order to attach the debugger to the app process.

Pick the nodemon process when prompted, the one that should look like npx nodemon --inspect src/index.ts. It's the process that stays alive and restarts the app process when you make changes (of course it first feeds the *.ts code to ts-node for transpilation because of that node --require ts-node/register line in nodemon.json).

@brokenthorn
brokenthorn / UserRegistrationForm.vue
Last active June 20, 2020 20:09
Vue + Vuetify 2.x User Registration Form Component
<template>
<v-card id="register-form-card">
<v-form ref="form" v-model="valid" @keyup.native.enter="submit">
<v-container>
<v-row no-gutters>
<v-col>
<v-alert color="error" :value="responseStatus !== ''">{{
responseStatus
}}</v-alert>
</v-col>