Skip to content

Instantly share code, notes, and snippets.

@t3dotgg
t3dotgg / try-catch.ts
Last active May 8, 2025 12:08
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@bmaupin
bmaupin / tiling-extensions-for-gnome.md
Last active January 20, 2025 12:51
Tiling extensions for Gnome

Goal: find a Linux alternative to FancyZones for Windows

Name Recommended Type Supports main colum Supports layouts Multiple windows in same tile Windows can span multiple zones Notes
Tiling Shell 👍👍👍 Gnome extension yes yes yes yes Explicitly inspired by Windows tiling, works great out of the box
gSnap 👍👍 Gnome extension yes yes yes yes Can be configured almost just like FancyZones; in the settings:
  • disable Show tabs
  • enable Hold CTRL to snap windows
gTile Gnome extension no?
Tiling Assistant ([Now bundled with Ubuntu](https://www.omgubuntu.co.uk/2023/06/
@fravelgue
fravelgue / 00-Using_SQLite.dib
Created November 8, 2022 22:06
Interactive (Polyglot) Notebook using SQLite
#!markdown
# Using SQLite in Notebook
Install ExtensionLab NuGet package
#!csharp
#r "nuget: System.Data.SQLite, *-*"
#r "nuget: Microsoft.DotNet.Interactive.ExtensionLab, *-*"
#!markdown
Records in C#
#!csharp
public class Course
{
public string Name {get; set;}
public string Author {get; set;}
@bbrt3
bbrt3 / dapper.dib
Last active November 21, 2022 22:45
#!csharp
#r "nuget:Microsoft.Extensions.Configuration"
#r "nuget:Microsoft.Extensions.Configuration.Json"
#r "nuget:Dapper"
#r "nuget:Dapper.Contrib"
#r "nuget:System.Data.SqlClient"
#r "System.IO"
#!csharp
@AlRado
AlRado / DownloadAndShowImages.dib
Created December 21, 2021 11:33
Downloads and displays images from the WEB
#!csharp
using System.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Interactive;
using Microsoft.DotNet.Interactive.Formatting;
using static Microsoft.DotNet.Interactive.Formatting.PocketViewTags;
void downloadAndShowImages(params string[] urls) {
display(span(urls.Select(url =>
@bbrt3
bbrt3 / Fundamentals---ORM.cs
Last active October 7, 2022 10:49
Entity Framework Core
/*
ORM (Object-Relational Mapping) allows us to have a framework
for storing objects within relational databases and translating between
DATABASE-CODE communication.
What is ORM?
1. Object relational mapping is a technique for storing,
retrieving, updating and deleting (CRUD) from
an object-oriented program in a relational database.
2. Utilization of "data layer" to manage translation between the OO and relational
@johannesprinz
johannesprinz / Dotnet-New-Clean-Architecture
Last active January 9, 2025 12:44
Dotnet Core - Clean Architecture Scaffold
# Outside of shell
# - Create project directory
# - git init
# - open in vs code >code .
# - Using remote container extensions create new development container
# - Using dotnet core 3.1 or later container template
# - Re-open in container and run the script below
dotnet new sln
dotnet new xunit -n Application.IntegrationTests -o ./tests/Application.IntegrationTests
@schauhan232
schauhan232 / HttpClientExtensions.cs
Last active March 21, 2023 11:06
Http Extension methods/Http Helper to get Response/ Request serialized and detribalized
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@ChrisTitusTech
ChrisTitusTech / fixlocale.sh
Created October 27, 2020 21:51
Fix Locales in any distro
#!/bin/bash
echo "LC_ALL=en_US.UTF-8" | sudo tee -a /etc/environment
echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
echo "LANG=en_US.UTF-8" | sudo tee -a /etc/locale.conf
sudo locale-gen en_US.UTF-8