Skip to content

Instantly share code, notes, and snippets.

<style>
@media screen {
#printSection {
display: none;
}
}
@media print {
body * {
visibility: hidden;
}
# default SHA256
(Get-FileHash -Path filepath).Hash -eq "SHA256Hash"
# MD5 Hash
(Get-FileHash -Path filepath -Algorithm MD5).Hash -eq "MD5hash"
# SHA512 Hash
(Get-FileHash -Path filepath -Algorithm MD5).Hash -eq "SHA512hash"
@hgirish
hgirish / html-input-text-inside-td.html
Created March 24, 2023 01:15
input text inside table td aligning with header row
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Table input</title>
<style>
table {
width: 100%;
@hgirish
hgirish / OpenXmlSearchString.cs
Created August 2, 2022 04:37
Search string in OpenXml SpreadsheetDocument and return Cell Reference
private static StringValue? SearchString(string searchString, WorkbookPart workbookPart, WorksheetPart worksheetPart)
{
var sharedTable = workbookPart.SharedStringTablePart;
var sharedStringValues = new List<SharedStringItem>();
if (sharedTable != null)
{
sharedStringValues =
sharedTable.SharedStringTable.Elements<SharedStringItem>().ToList();
}
<link href="~/lib/datatables/buttons.bootstrap5.min.css" rel="stylesheet" />
<link href="~/lib/datatables/dataTables.bootstrap5.min.css" rel="stylesheet" />
<script src="~/lib/datatables/jquery.dataTables.min.js"></script>
<script src="~/lib/datatables/dataTables.bootstrap5.min.js"></script>
<script src="~/lib/jszip/jszip.min.js"></script>
<script src="~/lib/datatables/js/dataTables.buttons.min.js"></script>
<script src="~/lib/datatables/js/buttons.colVis.min.js"></script>
<script src="~/lib/datatables/js/buttons.html5.min.js"></script>
@hgirish
hgirish / datatables.net-button-display.js
Created June 9, 2022 03:04
Display buttons on datatables before and after the table
$('#myTable').DataTable( {
dom: '<B<frtip>B>',
buttons: [
'colvis',
'excel',
'print'
]
} );
<link href="https://fonts.googleapis.com/css2?family=Libre+Barcode+39+Extended+Text&display=swap" rel="stylesheet">
<style>
.barcode39 {
font-family: 'Libre Barcode 39 Extended Text', cursive;
font-size: 40px;
}
</style>
@hgirish
hgirish / ApplicationUser.cs
Created June 4, 2022 07:05
Update Asp.Net Identity to Latest .net Core Identity, tested with Net6
// https://stackoverflow.com/questions/53878000/how-to-migrate-identity-users-from-a-mvc5-app-to-a-asp-net-core-2-2-app
/* We need a way to differentiate what users are using the new hash version or not.
One way is to add a new property to IdentityUser:
*/
using Microsoft.AspNetCore.Identity;
public class ApplicationUser: IdentityUser
{
@hgirish
hgirish / gist:af92d9449c3dc7da3904ddc3c38407bf
Last active June 3, 2022 04:19
Convert Html.Partial to Partial tag using find replace in VS
Find:
@Html.Partial\(\"(.*)\"\)
Replace:
<partial Name="$1" />
@hgirish
hgirish / get-all-migrations-name.ps1
Created December 17, 2019 07:10
Gets the list of EF migrations from C# aspnet core project
Get-ChildItem -Path . -Filter *.cs | Where-Object { $_.Name -match "^\d{14}_.*\.cs" } | Where-Object Name -NotLike "*Designer*"| Select-Object -ExpandProperty Name | Set-Content -path D:\Downloads\migrations.txt