Skip to content

Instantly share code, notes, and snippets.

@Atulin
Atulin / build.ps1
Created April 16, 2024 04:25
Build multiple versions of a .NET project
#======================================================================================================#
# SETTINGS #
#======================================================================================================#
$rids = 'win-x64', 'win-arm64', 'linux-x64', 'linux-arm64', 'osx-x64', 'osx-arm64'
$versions =
@{ Id='sc'; Params='-p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true'; },
@{ Id='fd'; Params='-p:PublishSingleFile=true --self-contained false'; }
# @{ Id='aot'; Params='-p:PublishTrimmed=true -p:PublishAot=true --self-contained true'; }
$project = 'MyProject.csproj'

Let's take database models like this:

public class Blogpost
{
    public int Id { get; set; }
    public string Title { get; set; }
    public string Body { get; set; }
    public List<Tag> Tags { get; set; }
    public User Author { get; set; }
 public id AuthorId { get; set; }
// Non-generic collections
T:System.Collections.ArrayList;Use List<T>
T:System.Collections.Hashtable;Use Dictionary<TKey, TValue>
// Blocking Task operations
P:System.Threading.Tasks.Task.Result;Await it
M:System.Threading.Tasks.Task.Wait;Await it
M:System.Threading.Tasks.Task.GetAwaiter;Await it
M:System.Runtime.CompilerServices.TaskAwaiter.GetResult;Await it
M:System.Threading.Tasks.Task.WaitAll`1;Use await Task.WhenAll()
@Atulin
Atulin / README.md
Last active June 14, 2022 18:53
Microsoft Devblog TOC

Microsoft Devblog TOC

Microsoft devblogs don't have ToC for some reason. So here's a fix.

@Atulin
Atulin / README.md
Last active December 8, 2023 23:11
FxTwitter Copy

Twitter Copy Fx Link

image

This script adds a new button to Twitter posts. Clicking it, copies a TwitFix link to your clipboard, and strips any trancking data from it because might as well.

@Atulin
Atulin / sizes.py
Created September 5, 2021 23:08
Calculates sizes and gzipped sizes of files in a directory
import glob
import os
import gzip
files = glob.glob('./**/*.min.js', recursive=True)
total_size = 0
longest = len(max(files, key=len))
@Atulin
Atulin / index.md
Last active May 30, 2021 11:18
Gitting started with Git

First, install Git from here.

Command Description
git init Initialize a repository in the current directory
git add . Start tracking all non-ignored files
git commit -m "message" Create a commit with a given message
git remote add origin [url] Add the remore repo with the [url] as the origin.
git push -u origin master First push to the remote repo, the origin branch. Sets the origin branch as the upstream for local master at the same time.
git push after the upstream is set, all further pushes are as simple as this
@Atulin
Atulin / Light.json
Created May 26, 2021 16:41
UE5 Light Mode
{
"Version": 1,
"Id": "136CB17E463AB88CFC67C5B937AA6596",
"DisplayName": "Light",
"Colors":
{
"EStyleColor::Black": "(R=1.000000,G=1.000000,B=1.000000,A=1.000000)",
"EStyleColor::Background": "(R=0.776042,G=0.776042,B=0.776042,A=1.000000)",
"EStyleColor::Title": "(R=0.864583,G=0.864583,B=0.864583,A=1.000000)",
"EStyleColor::WindowBorder": "(R=0.432292,G=0.432292,B=0.432292,A=1.000000)",
@Atulin
Atulin / whitepaper.md
Created May 24, 2021 19:42
A language with even more significant whitespace

Introduction

We all love languages with significant whitespace, right? Who doesn't love being unable to split code across multiple lines freely, or to create oneliners? What if we made whitespace even more significant..?

Features

Arithmetic operations order

It's decided by the amount of whitespace, of course!

// This part tells the code where to render the stuff
@Html.RenderResources("css")