This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://stackoverflow.com/questions/43080505/c-sharp-7-0-switch-on-system-type/46692500#46692500 | |
switch (object.GetType()) | |
{ | |
case Type _ when typ == typeof(SqlExpression<>): | |
Console.WriteLine("yes!"); | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @json NVARCHAR(MAX) = ' | |
[{ | |
"invoiceNumber": "7000962", | |
"invoiceDate": "2018-08-22T00:00:00.000-07:00", | |
"transactionName": "RES LH INV", | |
"invoiceDueDate": "2018-09-01T00:00:00.000-07:00", | |
"originalInvoiceAmount": "3291.17", | |
"amountRemainingOnInvoice": "3291.17", | |
"sentToCollectionStatus": "False" | |
}, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the blocker for what i needed at the time was these techniques only appear to resolve the DI required | |
//for populating nested properties within the root object deserialization... | |
//but i was looking for DI to the root object constructor and that wasn't happening yet... | |
//my guess is doing something more DI savvy in the ContractResolver... | |
//we see that the root object comes through there, but that object itself is not DI'd... | |
//i.e. it's not an interface mapped to a class itself... | |
//it has an interface in the constructor parms | |
//so maybe doing something like ActivatorUtilities.CreateInstance(IServiceProvider, concreteType) | |
//instead of sp.GetService(concreteType) at line 65 below... that actually smells pretty promising |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ultimately this sever feature stuff isn't available in azure until after startup | |
var runningHostAddresses = app.ServerFeatures.Get<IServerAddressesFeature>().Addresses.Select(a => new Uri(a).Host); | |
var isLocalDev = new[] { "127.0.0.1", "localhost" }.Intersect(runningHostAddresses).Count() > 0; | |
Environment.SetEnvironmentVariable("eComm_Storefront_localdev", isLocalDev.ToString()); | |
_logger.LogInformation($"running on host ips: {string.Join(", ", runningHostAddresses)}"); | |
// | |
//it's fuzzy to see a good established pattern for doing local overrides for settings retrieved from a web api | |
//especially since the existing paradigm is based on Azure subscriptions (aka environments) being populated with settings, | |
//and a "localdev" PER DEVELOPER environment doesn't seem to be an easily retrofitted concept |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//wscript debugger = scd10en.exe | |
// http://www.mediafire.com/file/bvobcrm39ve1ywn/Microsoft+script+debugger.zip | |
// https://www.google.com/search?q=scd10en.exe | |
//https://stackoverflow.com/questions/10980171/how-do-i-get-microsoft-script-debugger-to-work-with-64-bit-windows-7 | |
//*** have launch the win32 version of cscript/wscript | |
// /d /x starts debugger | |
// %windir%\SysWOW64\cscript.exe /d /x script.js arg1 arg2 | |
var wshShell = WScript.CreateObject("WScript.Shell"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SRI = Subresources Integrity | |
var script = document.createElement("script"); | |
script.setAttribute("src", "https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.21.6/system.js"); //new SystemJs v2+ doesn't support CJS modules | |
script.addEventListener('load', async () => { | |
System.config({ | |
//msal requires an [SRI hash](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) | |
meta: { "https://alcdn.msftauth.net/lib/1.2.1/js/msal.js": { integrity: "sha384-9TV1245fz+BaI+VvCjMYL0YDMElLBwNS84v3mY57pXNOt6xcUYch2QLImaTahcOP" } }, | |
//set .js as default extension for any NESTED dependencies "require()'d" from within the main import below |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/bubkoo/html-to-image | |
//load systemjs as a way to import html-to-image library which is published as node module with require dependencies | |
//you could do this via normal <script> tag as well | |
var script = document.createElement("script"); | |
script.setAttribute("src", "https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.21.6/system.js"); //new SystemJs doesn't support CJS modules | |
document.body.appendChild(script); | |
//set .js as default extension for nested dependencies "require()'d" from index.js below | |
System.config({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
set source=%~f1 | |
call:remove_quotes %source% | |
set dest=%~f2 | |
call:remove_quotes %dest% | |
::echo source: %source% | |
::echo dest: %dest% | |
::pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# oh yeah!! | |
npm i ((Get-Content .\package.json | ConvertFrom-Json).dependencies | gm -Name @Progress* | select -ExpandProperty Name | % { $_ + "@latest" } ) | |
# npm list filtered by name and joined on one line | |
# facilitates doing a bunch of updates to the whole kendo bundle | |
# old way: npm list 2>$null | sls "^\+-- (@progress.*?)@" | select @{n="val";e={$_.matches[0].groups[1].value+"@latest"}} | join-string -property val -separator " " | clip | |
npm list 2>$null | sls "^\+-- (@progress.*?)@" | % { $_.matches[0].groups[1].value} | join-string -Separator " " | |
# *nix sed is more concise on this one |