Skip to content

Instantly share code, notes, and snippets.

View michal-ciechan's full-sized avatar

Michal Ciechan michal-ciechan

  • Maven
View GitHub Profile
public static class SqlBulkCopyEx
{
public static void BulkInsert<T>(string connectionString, IEnumerable<T> list, int batchSize = 0, string table = null)
{
using (var bulkCopy = new SqlBulkCopy(connectionString))
{
var type = typeof (T);
var tableName = type.Name;
var tableAttribute = (TableAttribute)type.GetCustomAttributes(typeof (TableAttribute), false).FirstOrDefault();
@michal-ciechan
michal-ciechan / Bookmarklet - Copy Link - Title.js
Created October 8, 2020 09:02
Bookmarklet - Copy Link - Title
@michal-ciechan
michal-ciechan / .editorconfig
Last active June 10, 2021 10:38
C# .editorconfig
root = true
# Version: 2.1.0 (Using https://semver.org/)
# Updated: 2021-03-03
# See https://github.com/RehanSaeed/EditorConfig/releases for release notes.
# See https://github.com/RehanSaeed/EditorConfig for updates to this file.
# See http://EditorConfig.org for more information about .editorconfig files.
##########################################
# Common Settings
##########################################
@michal-ciechan
michal-ciechan / Bookmarklet - Copy Jira Branch Name.js
Last active December 2, 2021 10:22
Copy JIRA as Branch Name
javascript:(function() {
function selectNode(node) {
const range = document.createRange();
range.selectNode(node);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
@michal-ciechan
michal-ciechan / renameAll.ps1
Created January 11, 2022 03:06
Replace File Contents + Names + Folder Names
$old = "AngularDemo"
$new = "NewProjectName"
Get-ChildItem -Filter "old" - Recursive | Rename-Item -NewName { $.name -replace $old, $new }
$filesTypesToSearch = @(".cs", ".sln", ".csproj", ".config", "*.json")
Get-ChildItem -Include $filesTypesToSearch -Recurse |
ForEach-Object { $a = $.FullName; ( Get-Content $a ) |
ForEach-Object { $_ -replace $old, $new } |
@michal-ciechan
michal-ciechan / install-utils.ps1
Last active October 16, 2023 19:40
Util Installation
# General
winget install Google.Chrome --accept-package-agreements
winget install windirstat --source winget --accept-package-agreements
winget install screentogif --source winget --accept-package-agreements
winget install Microsoft.VisualStudioCode --accept-package-agreements
winget install obsidian --source winget --accept-package-agreements
winget install typora --source winget --accept-package-agreements
winget install KeePass --source winget --accept-package-agreements
winget install Dropbox --source winget --accept-package-agreements
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
namespace MikeysBenchmarks;
[SimpleJob(RuntimeMoniker.Net70)]
[MemoryDiagnoser()]
[MarkdownExporter]
public class SpanTrimZ
{