Skip to content

Instantly share code, notes, and snippets.

View kimfom01's full-sized avatar
🏗️
C# | on a journey

Kim Fom kimfom01

🏗️
C# | on a journey
View GitHub Profile
@m-jovanovic
m-jovanovic / .editorconfig
Created June 7, 2023 12:17
Sample editor config with a bunch of rules turned off 😅
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
//program.cs
var app = builder.Build();
var scope = app.Services.CreateScope();
await DataHelper.ManageDataAsync(scope.ServiceProvider);
public static class ConnectionHelper
{
public static string GetConnectionString(IConfiguration configuration)
{
var connectionString = configuration.GetConnectionString("DefaultConnection");
var databaseUrl = Environment.GetEnvironmentVariable("DATABASE_URL");
return string.IsNullOrEmpty(databaseUrl) ? connectionString : BuildConnectionString(databaseUrl);
}
//build the connection string from the environment. i.e. Heroku
public static class DataHelper
{
public static async Task ManageDataAsync(IServiceProvider svcProvider)
{
//Service: An instance of db context
var dbContextSvc = svcProvider.GetRequiredService<ApplicationDbContext>();
//Migration: This is the programmatic equivalent to Update-Database
await dbContextSvc.Database.MigrateAsync();
@pmkay
pmkay / installing-postman.md
Created April 27, 2020 02:49 — forked from ba11b0y/installing-postman.md
Installing Postman on Ubuntu/Gnome

Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux

Although I highly recommend using a snap

sudo snap install postman

Installing Postman

tar -xzf Postman-linux-x64-5.3.2.tar.gz
@caudamus
caudamus / README.md
Last active February 28, 2024 13:30
BNF Parser

BNF parsing

Toy weekend project: make a parser-parser!

This takes in a grammar given in Bakus-Naur Form (BNF), and a program that was written in the provided grammar, and produces an image of Syntax Tree using graphviz.

References: