Skip to content

Instantly share code, notes, and snippets.

View DiomedesDominguez's full-sized avatar

Diomedes Ignacio Domínguez Ureña DiomedesDominguez

View GitHub Profile
@DiomedesDominguez
DiomedesDominguez / dotnetcheatsheet.md
Last active March 16, 2024 12:43 — forked from jonlabelle/dotnetcheatsheet.md
Dotnet core Cheat Sheet
# This goes in your Microsoft.PowerShell_profile.ps1 (can find the path via $PROFILE in your prompt)
Import-Module -Name posh-git,oh-my-posh,Terminal-Icons
Set-PoshPrompt -Theme craver

※ Raspberry Pi RAID NAS Server Setup ※

Hardware:

  • Raspberry Pi 4 (4GB RAM)
  • Micro SD card 32GB
  • 2x Integral USB 3.1 flash drives 128GB

OS:

  • Raspbian Buster
@DiomedesDominguez
DiomedesDominguez / ModelBuilderExtensions.cs
Created August 14, 2020 20:03
Change the default datatype for string
public static void SetDefaultDataType(this ModelBuilder modelBuilder)
{
foreach (var entity in modelBuilder.Model.GetEntityTypes().Where(x => x.ClrType.GetCustomAttribute(typeof(TableAttribute)) != null))
{
var entityClass = entity.ClrType;
foreach (var property in entityClass.GetProperties().Where(p => p.PropertyType == typeof(string)
&& p.PropertyType.IsPublic && p.CanWrite
&& !Attribute.IsDefined(p, typeof(ColumnAttribute))
&& !Attribute.IsDefined(p, typeof(NotMappedAttribute))))
@DiomedesDominguez
DiomedesDominguez / ApplicationDbContext.cs
Last active July 14, 2023 22:53
The main goal of ModelBuilderExtentions.cs is to use DataAnnotations more in our tables instead of using Fluent. The other files are mere examples.
namespace MyDotNetCore.App
{
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
FROM mcr.microsoft.com/mssql/server:latest as base
USER root
LABEL MAINTAINER=DNMOFT
EXPOSE 80
EXPOSE 1433
EXPOSE 443
ENV ACCEPT_EULA=Y
ENV SA_PASSWORD=Code1234,
#ENV MSSQL_PID=Enterprise
ENV MSSQL_TCP_PORT=1433
@DiomedesDominguez
DiomedesDominguez / jquery.jtable.js
Created September 20, 2016 14:39
jQuery Table based on jTable 2.4.0
/*
jTable 2.4.0
http://www.jtable.org
---------------------------------------------------------------------------
Copyright (C) 2011-2014 by Halil İbrahim Kalkan (http://www.halilibrahimkalkan.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
@DiomedesDominguez
DiomedesDominguez / Bluetooth Printer on Xamarin.Android
Created July 20, 2016 21:35
Code Snippet for a Bluetooth mobile printing service
private BluetoothAdapter mBluetoothAdapter = null;
private BluetoothDevice mmDevice = null;
private BluetoothSocket mmSocket = null;
private Stream mmOutputStream;
private Stream mmInputStream;
private void FindPrinter()
{