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
@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 / 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: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
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: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"
}
http://anthonygiretti.com/2018/09/06/how-to-unit-test-a-class-that-consumes-an-httpclient-with-ihttpclientfactory-in-asp-net-core/
public static class StringExtensions
{
private delegate bool TryParseDelegate<T>(string s, out T result);
private static T To<T>(string value, TryParseDelegate<T> parse)
=> parse(value, out T result) ? result : default;
public static int ToInt32(this string value)
=> To<int>(value, int.TryParse);
@thdotnet
thdotnet / gist:1eb1b8414606329e2db1f87dfc54afb6
Created October 2, 2017 20:34
MSBuild Error for Service Fabric projects
Here are the steps I followed to resolve the issue.
Right click on (load Failed) project and edit in visual studio.
Saw the following line in the Project tag: <Project Sdk="Microsoft.NET.Sdk.Web" >
Followed the instruction shown in the error message to add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to this tag
source: https://stackoverflow.com/a/44785842/1384539
@thdotnet
thdotnet / gist:8e07cf73026bafddb3491919c9dabc70
Created February 22, 2017 09:22
Fix HttpContext.Current sometimes null
Sometimes the root cause of HttpContext.Current null is the missing <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> in the web.config
@thdotnet
thdotnet / gist:58d3682ebfd5f72473a0a73e938d4358
Created January 18, 2017 22:07
Update Microsoft.Owin fix
Problem with Microsoft.Owin 2.0.1
Update-Package Microsoft.Owin -Reinstall