Skip to content

Instantly share code, notes, and snippets.

View pancholopez's full-sized avatar
🤠
Hi

Francisco Lopez Gonzalez pancholopez

🤠
Hi
  • Axion Bio
  • Eindhoven, The Netherlands
  • 09:45 (UTC +02:00)
View GitHub Profile
@pancholopez
pancholopez / README.md
Created June 11, 2025 09:51
Document how to use EF migrations with the dotnet CLI

Using dotnet ef Tool for Database Migrations

This guide explains how to use the dotnet ef (Entity Framework Core Command-line Tools) for creating and managing database migrations in .NET applications.

Prerequisites

  • .NET SDK installed (download)

  • Entity Framework Core NuGet packages installed:

  • For most projects:

@pancholopez
pancholopez / wsl2-update.ps1
Created January 25, 2025 17:53
Keep Ubuntu WSL2 up to date
$Time = New-ScheduledTaskTrigger -At 12:00 -Weekly -WeeksInterval 1 -DaysOfWeek Monday
$Actions = @( New-ScheduledTaskAction -Execute "wsl" -Argument "--user root --exec apt-get update", "--user root --exec apt-get upgrade --yes" )
$Settings = New-ScheduledTaskSettingsSet -WakeToRun:$false -MultipleInstances IgnoreNew -RunOnlyIfNetworkAvailable:$true -StartWhenAvailable:$true
Register-ScheduledTask -TaskName "Update wsl" -Trigger $Time -Action $Actions -Settings $Settings -TaskPath "Updates"
@pancholopez
pancholopez / counter.js
Created July 26, 2023 08:56
simple countdown counter in JS
// simple counter
const counterModule = (function () {
const colors = ["Black", "Blue", "Cyan", "Purple", "Magenta", "Green", "Red", "Gray", "Orange"];
let count = 0;
let intervalId;
let resetTime = 60; // Default reset time in seconds
let colorCounter = 0;
function updateCounter() {
@pancholopez
pancholopez / WarmUpHelper.cs
Last active April 21, 2023 13:16
Http "Warm Up" utility for integration testing
public static class WarmUpHelper
{
public static async Task WarmUpPageAsync(string url)
{
// Create a new instance of HttpClient with a timeout of 10 seconds
using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
try
{
// Send a GET request to the specified URL
@pancholopez
pancholopez / HashCode.cs
Last active April 20, 2023 09:26
HashCode combination utility compatible to .net standard 2.0
using System;
using System.Diagnostics.CodeAnalysis;
namespace MyUtils.Core
{
/// <summary>
/// HashCode combination utility compatible to .net standard 2.0
/// </summary>
[ExcludeFromCodeCoverage]
internal static class HashCode
@pancholopez
pancholopez / http-client.env.json
Created April 18, 2023 09:54
Jetbrains Rider HttpClient example with environment variables
{
"local": {
"jwtHost": "localhost:7132",
"email": "user@example.com",
"password": "12345"
},
"development": {
"jwtHost": "mysite.azurewebsites.net",
"email": "realUser@example.com",
"password": "54321"
@pancholopez
pancholopez / README.md
Created March 14, 2023 11:19
readme example

My-Project-Name

Identity management using AspNet Identity and JWT bearer tokens

Installation

Use the package manager pip to install foobar.

pip install foobar
@pancholopez
pancholopez / ServicesInstaller.cs
Created March 9, 2023 14:34
Helper class to register class library dependencies
/// <summary>
/// responsible to add and setup services in the IOC container
/// </summary>
public interface IServicesInstaller
{
/// <summary>
/// Install and setup all services
/// </summary>
/// <param name="services">service collection</param>
/// <param name="configuration">application configuration</param>
@pancholopez
pancholopez / Entity.cs
Last active April 1, 2025 14:14
DDD Domain Entity and Smart Enumeration
/// <summary>
/// base class that represents a domain Entity
/// </summary>
public abstract class Entity : IEquatable<Entity>
{
public Guid Id { get; private init; }
public Entity(Guid guid)
{
Id = guid;
@pancholopez
pancholopez / DateTimeExtensions.cs
Created December 21, 2022 14:51
Convert a date to ISO 8601 and back
public static class DateTimeExtensions
{
public static string ToIsoString(this DateTime dateTime)
{
return dateTime.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
}
public static DateTime FromIsoString(string isoString)
{
return DateTime.Parse(isoString, null, System.Globalization.DateTimeStyles.RoundtripKind);