Skip to content

Instantly share code, notes, and snippets.

@robsonfaxas
robsonfaxas / snakeCase.cs
Last active February 26, 2024 22:15
[ASP.NET Core TW - EF Core case insensitive SnakeCase] tornar tabelas geradas pelo EF Core NamesToSnakeCase #DotNetCore
// 2 classes de métodos de extensão: StringExtensions e ModelBuilderExtensions
// 1 - String Extensions
using System.Text.RegularExpressions;
using Microsoft.EntityFrameworkCore;
namespace HelloWorldAspNetCore.Extensions
{
public static class StringExtensions
{
@alanorth
alanorth / iso3166-1.json
Created July 31, 2020 13:09
ISO 3166-1 JSON from iso-codes
{
"3166-1": [
{
"alpha_2": "AW",
"alpha_3": "ABW",
"name": "Aruba",
"numeric": "533"
},
{
"alpha_2": "AF",
@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
@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;
@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
@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
@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 / 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
#!markdown
Records in C#
#!csharp
public class Course
{
public string Name {get; set;}
public string Author {get; set;}
@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, *-*"