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 ($w, undefined) { | |
function Namespace(namespace, parent, separator) { | |
var parts = namespace.split(separator || '.'), | |
_parent = parent || window, | |
currentPart = ''; | |
for (i = 0, ii = parts.length; i < ii; i++) { | |
currentPart = parts[i]; | |
_parent[currentPart] = _parent[currentPart] || {}; | |
_parent = _parent[currentPart]; | |
} |
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(d, w) { | |
var utility = { | |
trim: word => word.replace(/(^\s+|\s+$)/g, ''), | |
empty: word => !word || /^\s*$/.test(word), | |
createNode: (node, text) => { | |
let element = d.createElement(node); | |
if (text) element.innerText = text; | |
return element; | |
}, | |
toArray: list => list instanceof Array ? list : Array.prototype.slice.call(list) |
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 namespace System.IO | |
using namespace System.Net | |
using namespace System.Net.Sockets | |
class RconClient { | |
hidden [Socket]$_socket | |
hidden [int]$_id = 1 | |
RconClient([Socket]$socket) { | |
$this._socket = $socket |
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 NUnit.Framework; | |
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace UnitTests | |
{ | |
[TestFixture] | |
class GivenSemaphoreSlim |
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 ConvertTo-Mockaco { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] | |
[object] | |
$Har, | |
# Output path to Mockaco Mocks folder | |
[Parameter(Mandatory=$false)] | |
[string] |
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
# | |
# OpenSSL example configuration file. | |
# This is mostly being used for generation of certificate requests. | |
# | |
# Note that you can include other files from the main configuration | |
# file using the .include directive. | |
#.include filename | |
# This definition stops the following lines choking if HOME isn't |
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
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base | |
WORKDIR /app | |
EXPOSE 80 | |
EXPOSE 443 | |
ENV ASPNETCORE_URLS "https://+,http://+" | |
ENV ASPNETCORE_HTTPS_PORT 443 | |
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | |
ENV NODE_VERSION 18.x |
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.IdentityModel.Tokens.Jwt; | |
using System.Security.Claims; | |
using System.Text.Json; | |
using System.Text.Json.Serialization; | |
using Microsoft.Extensions.Caching.Distributed; | |
using Microsoft.IdentityModel.Tokens; | |
/// <summary> | |
/// Reject JWT token containing blacklisted JTI. The JTI is registered into cache provider to be blacklisted, |
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 abstract record Result | |
{ | |
#region Helper methods | |
public static Success Ok() => new(); | |
public static Success.WithValue<T> Ok<T>(T value) => new(value); | |
public static Failure Fail(string reason) => new(Codes.Unprocessable, reason); | |
public static Failure Error(Exception exception) => new(Codes.Unknown, exception.Message); | |
public static Failure NotFound(string entity) => new(Codes.NotFound, $"{entity} is not found."); | |
public static Failure.Invalid Reject(IDictionary<string, string[]> errors) => new(errors); |
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.Diagnostics.CodeAnalysis; | |
using MediatR; | |
using static StatusCodes; | |
// sample usages | |
app.MapCommand<RegisterCustomerDto, RegisterCustomer.Command>("customers", dto => new(dto.Name, dto.Email)); | |
app.MapQuery<GetCustomerDetailDto, GetCustomerDetail.Query>("customers/{CustomerId:int}", dto => new(dto.CustomerId)); | |
public class RegisterCustomerDto | |
{ |
OlderNewer