Skip to content

Instantly share code, notes, and snippets.

View caseyspaulding's full-sized avatar
🎯

Casey Spaulding caseyspaulding

🎯
View GitHub Profile
//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();
@arkada38
arkada38 / AAA.md
Last active February 4, 2024 14:39
Using Tailwind CSS v3.2 with Blazor (.Net 6 or above)

Using Tailwind CSS v3.2 with Blazor (.Net 6 or above)

This method works for Blazor Server and Blazor WebAssembly with hot reload, style isolation and tailwind jit compilation.

Setup with using Standalone Tailwind CSS CLI without Node.js

For this method you need added to path Tailwind CSS CLI binary. Read more about Standalone CLI.

Just create a StaticAssets folder in the root of your project with next structure.

@febritecno
febritecno / notes.vb
Last active March 5, 2024 20:15 — forked from nicr9/notes.vb
Visual Basic Cheat Sheet
http://howtostartprogramming.com/vb-net/
' Data Types
Integer ' Simple numbers
Double ' Numbers with decimal points
String ' Text (a string of characters)
Boolean ' True or False
' Create a variable
@Potherca
Potherca / solutions-stacks.csv
Last active September 28, 2024 06:53
Solution Stack Acronyms
Stack Name Stack Type Operating System / Platform Server Database Language or SDK Framework UI Message Bus / Queue
AMP Web (Backend) Apache MySQL / MariaDB Perl / PHP / Python
BAMP Web (Backend) BSD Apache MySQL / MariaDB Perl / PHP / Python
BAPP Web (Backend) BSD Apache PostgreSQL Perl / PHP / Python
BCHS Web (Backend) BSD SQLite httpd C
DAMP Web (Backend) Darwin Apache MySQL / MariaDB Perl / PHP / Python
ELK Time Series Data Logstash Elasticsearch Kibana
ELKB Time Series Data Logstash Elasticsearch Beats Kibana
FAMP Web (Backend) FreeBSD Apache MySQL / MariaDB Perl / PHP / Python
FWAP Web (Backend) Windows Apache Firebird Perl / PHP / Python
@jgornick
jgornick / gist:323115
Created March 5, 2010 20:34
JS: Amortization Calculator
(function(global) {
// Sample Calculators:
// http://www.pine-grove.com/Web%20Calculators/interest.htm
var startingBalance = 10000.00,
totalBalance = startingBalance,
apr = (17.5 / 100),
months = 11,
interest,
customMonthlyPayment = 1000,