Skip to content

Instantly share code, notes, and snippets.

View thdotnet's full-sized avatar

Thiago Custodio thdotnet

  • Xpirit USA
  • Texas, USA
View GitHub Profile
http://anthonygiretti.com/2018/09/06/how-to-unit-test-a-class-that-consumes-an-httpclient-with-ihttpclientfactory-in-asp-net-core/
@thdotnet
thdotnet / gist:873bfa890271dd30da8ab2f2e897cd96
Created January 16, 2019 10:37
testing azure event grid
//source: https://www.codit.eu/blog/writing-tests-for-azure-event-grid/
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"EventGrid.Topic.Name": {
"type": "string",
"metadata": {
"description": "Name of the custom Azure Event Grid topic"
}
declare @TableName sysname = 'TableName'
declare @Result varchar(max) = 'public class ' + @TableName + '
{'
select @Result = @Result + '
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }
'
from
(
select
@thdotnet
thdotnet / gist:adcfc37115b6070f4570f5ef8c443751
Created February 6, 2020 15:47
aspnet core - http 502.2
https://docs.microsoft.com/en-us/aspnet/core/signalr/publish-to-azure-web-app?view=aspnetcore-3.1
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/azure-apps/?view=aspnetcore-3.1&tabs=visual-studio#deploy-aspnet-core-preview-release-to-azure-app-service
@thdotnet
thdotnet / Program.cs
Created March 9, 2020 21:37 — forked from Mark-Broadhurst/Program.cs
Lucence Spatial Search 3.0.3
namespace LuceneExample
{
#region Namespaces
using System;
using System.Globalization;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Documents;
using Lucene.Net.Index;
@thdotnet
thdotnet / gist:a70bcfa3858f6ac7f01e6990bb6bf604
Created March 9, 2020 21:38
T-SQL - GeoDistance sample
DECLARE @LAT VARCHAR(10)
DECLARE @LONG VARCHAR(10)
DECLARE @GEO2 GEOGRAPHY
DECLARE @LAT_B VARCHAR(10)
DECLARE @LONG_B VARCHAR(10)
SET @LAT='29.0'
SET @LONG='-95.612528'
@thdotnet
thdotnet / gist:4781ad32ab126da27af144ab6e90f928
Created September 24, 2021 12:58
load and interpret JS scripts
//sample.js
window.onload = function () {
var setInnerHTML = function (elm, html) {
elm.innerHTML = html;
Array.from(elm.querySelectorAll("script")).forEach(oldScript => {
const newScript = document.createElement("script");
Array.from(oldScript.attributes)
.forEach(attr => newScript.setAttribute(attr.name, attr.value));
newScript.appendChild(document.createTextNode(oldScript.innerHTML));
apiVersion: v1
# The type of workload we are creating
kind: Service
metadata:
# Name of Service - Required
name: aks-web-app-service
# Specific details about the Service
spec:
# Type of Service to be deployed
type: LoadBalancer
apiVersion: apps/v1
# The type of workload we are creating
kind: Deployment
metadata:
# Name of deployment - Required
name: aks-web-app-deployment
spec:
replicas: 2
selector:
matchLabels:
using System;
using System.Linq.Expressions;
namespace Sample
{
public class GenericSpecification<T>
{
public Expression<Func<T, bool>> Expression { get; }
public GenericSpecification(Expression<T, bool> expression)