Skip to content

Instantly share code, notes, and snippets.

@hgirish
hgirish / gist:892f46b027e975386b5cbd4657f5bf1f
Created August 30, 2024 18:01
filter bad date string in M language in Power BI or PowerQuery
# Changed Type1 is previous transformation name
# FilteredDate is new column added
# [Date] is name of column containing dates in text format
= Table.AddColumn(#"Changed Type1", "FilteredDate", each try Value.Is(Date.From([Date]), type date) otherwise false )
@hgirish
hgirish / ssis-blank-date-cast-to-dt-date
Created August 18, 2024 07:08
SSIS import date in string to DB date when date is blank using Derived Column Task
# expression for date column in Derived Column Task
TRIM(DateUpdatedstring) == "" ? NULL(DT_DATE) : (DT_DATE)DateUpdatedstring
<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
{