Skip to content

Instantly share code, notes, and snippets.

View d-oit's full-sized avatar
💭
I may be slow to respond.

Dominik Oswald d-oit

💭
I may be slow to respond.
View GitHub Profile
@d-oit
d-oit / createPOCO.sql
Created May 25, 2019 13:58
Create C# POCO from existing MS SQL table
declare @tableName varchar(200)
declare @columnName varchar(200)
declare @nullable varchar(50)
declare @datatype varchar(50)
declare @maxlen int
declare @sType varchar(50)
declare @sProperty varchar(200)
DECLARE table_cursor CURSOR FOR
@d-oit
d-oit / SyncfusionCrudAppService.cs
Created January 3, 2020 09:16
Aspnetboilerplate Syncfusion CRUD
namespace Doit.Erp.Syncfusion
{
public class SyncfusionCrudAppService<TEntity, TEntityDto, TPrimaryKey, TCreateInput, TUpdateInput, TGetInput, TDeleteInput> : ApplicationService, ISyncfusionCrudAppService<TEntity, TEntityDto, TPrimaryKey, TCreateInput, TUpdateInput, TGetInput, TDeleteInput>
where TEntity : class, IEntity<TPrimaryKey>
where TEntityDto : IEntityDto<TPrimaryKey>
where TUpdateInput : IEntityDto<TPrimaryKey>
where TGetInput : IEntityDto<TPrimaryKey>
where TDeleteInput : IEntityDto<TPrimaryKey>
{
protected readonly IRepository<TEntity, TPrimaryKey> Repository;
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
@d-oit
d-oit / SolutionDir.csproj
Created April 30, 2020 11:15
$(SolutionDir) variable for DevOps xcopy jobs
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
<PropertyGroup>
<ProjectFolder>$([System.IO.Directory]::GetParent($'(ProjectDir)'))</ProjectFolder>
<ParentFolder>$([System.IO.Directory]::GetParent($'(ProjectFolder)'))\</ParentFolder>
<SolutionDir Condition=" '$(SolutionDir)' == '' Or '$(SolutionDir)' == '*Undefined*' ">$(ParentFolder)</SolutionDir>
using System;
using System.Globalization;
namespace Extensions
{
public static partial class DateTimeExtensions
{
public static int GetMonthDifference(DateTime startDate, DateTime endDate)
{
int monthsApart = 12 * (startDate.Year - endDate.Year) + startDate.Month - endDate.Month;
@d-oit
d-oit / gist:1cdf2a8e185207829f775cc3a425478e
Created December 3, 2020 10:28 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@d-oit
d-oit / AspnetCoreSwaggerHttpGet.cs
Created December 9, 2020 14:01
ASP.net core Swagger - download file
[HttpGet]
[SwaggerResponse(HttpStatusCode.OK, typeof(FileContentResult))]
[ProducesResponseType(typeof(FileContentResult), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(BadRequestObjectResult), StatusCodes.Status400BadRequest)]
public async Task<FileContentResult> GetFileExcel(FilterPagedAndSortedResultRequestDto input, RequestExcelDto requestExcel)
{
var entities = await GetAllWithFilterAsync(input);
var buffer = await _generator.CreateAsync(
entities.Items.ToList(),
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
@d-oit
d-oit / Windows Defender Exclusions VS 2022.ps1
Created April 20, 2024 18:07 — forked from Braytiner/Windows Defender Exclusions VS 2022.ps1
Adds Windows Defender exclusions for Visual Studio 2022
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\.dotnet') > $null
$pathExclusions.Add($userPath + '\.librarymanager') > $null
@d-oit
d-oit / gist:0e8cb69d5fb5f0584336c893ee75ad9c
Created April 23, 2024 08:05
PowerShell Windows 10/11: battery health report
powercfg /batteryreport /output "C:\battery-report.html"