This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net.Http; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 { |
This file contains hidden or 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
# to install a package right from GitHub | |
# this will install the package under the {current_path}/node_modules/{package_name}/ | |
npm install https://github.com/windowsazure/azure-sdk-tools-xplat/tarball/dev | |
# if you wanna install a global package, use the -g switch | |
# This will put the package under %appdata%\npm\ and it'll also put | |
# directly invokable cmd and sh (I assue it is sh file. It has no extension) files. | |
# For example, for azure, it'll create the azure and azure.cmd files under %appdata%\npm\. | |
# As the %appdata%\npm\ is under my path, we can just do: azure. | |
# However, this only happens for azure AFA I can see. this may be enabled by a "after install" |
This file contains hidden or 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
public class UserHostAddressSetterHandler : DelegatingHandler { | |
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { | |
request.Properties[ApiCommonRequestKeys.UserHostAddressKey] = request.GetUserHostAddress(); | |
return base.SendAsync(request, cancellationToken); | |
} | |
} | |
internal static class HttpRequestMessageExtensions { |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<solution> | |
<add key="disableSourceControlIntegration" value="true" /> | |
</solution> | |
<packageSources> | |
<add key="LocalRepositoryName" value="c:\dev\nuget" /> | |
</packageSources> | |
</configuration> |
This file contains hidden or 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
public virtual async Task DeleteAsync(Guid id) { | |
var obj = await _service.GetByIdAsync(id); | |
if (!_authorization.IsCurrentUserAllowedToDelete(obj)) { | |
throw new UnauthorizedAccessException(Exceptions.IdentityNotMapped); | |
} | |
await _service.DeleteAsync(id); | |
} |
This file contains hidden or 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
<appSettings> | |
<add key="aspnet:UseHostHeaderForRequestUrl" value="true"/> | |
</appSettings> |
This file contains hidden or 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
(function () { | |
var root = this; | |
define3rdPartyModules(); | |
function define3rdPartyModules() { | |
// These are already loaded via bundles. | |
// We define them and put them in the root object. | |
define('jquery', [], function () { return root.jQuery; }); |
This file contains hidden or 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
-- http://stackoverflow.com/questions/3800551/sql-select-first-row-in-each-group-by-group | |
-- http://dbaspot.com/sqlserver-programming/363437-union-two-ctes-together.html | |
-- http://stackoverflow.com/questions/354224/combining-union-all-and-order-by-in-firebird | |
WITH FirstLogs AS ( | |
SELECT | |
l.[CorrelationId], | |
l.[Timestamp], | |
ROW_NUMBER() OVER(PARTITION BY l.[CorrelationId] ORDER BY l.[Timestamp] ASC) AS rk | |
FROM [DependencyScopeTracingDisposeBug.Models.Entities.WebApiTracerContext].[dbo].[HttpApiLogRecords] l | |
), |
This file contains hidden or 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
[EditorBrowsable(EditorBrowsableState.Never)] | |
internal static class HttpResponseMessageExtensions { | |
internal static async Task<HttpApiResponseMessage<TEntity>> GetHttpApiResponseAsync<TEntity>(this Task<HttpResponseMessage> responseTask) { | |
HttpResponseMessage response = await responseTask.ConfigureAwait(false); | |
HttpApiResponseMessage<TEntity> apiResponse = await response.GetHttpApiResponseAsync<TEntity>().ConfigureAwait(false); | |
return apiResponse; | |
} |
This file contains hidden or 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
using Newtonsoft.Json; | |
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.Diagnostics.CodeAnalysis; | |
using System.Dynamic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Net; |