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
namespace MoqDemo.Tests | |
{ | |
using System; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
using Moq; | |
using NUnit.Framework; | |
using HomeController = Controllers.HomeController; |
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
const sum: (...values: any[]) => number = (...values) => { | |
return values.reduce( | |
(total, val) => total + (isNaN(Number(val)) ? 0 : Number(val)) | |
); | |
}; | |
export { sum }; |
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
const isSubclassOf = function isSubclassOf(derived: any, base: any) { | |
const pair = [Reflect.getPrototypeOf(derived), base]; | |
const allKeys = pair.reduce( | |
(keys, instance) => keys.concat(Object.keys(instance)), | |
[] | |
); | |
const distinctKeys = new Set(allKeys); |
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.Runtime.CompilerServices; | |
using System.Threading.Tasks; | |
//// inspired by Stephen Toub's https://devblogs.microsoft.com/pfxteam/asynclazyt/ | |
/// <summary> | |
/// Provides support for async lazy initialization. | |
/// </summary> | |
/// <typeparam name="T">Specifies the type of element being lazily initialized.</typeparam> |
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 static string GetBot(string message) | |
{ | |
string bot = $"\n {message}"; | |
bot += @" | |
__________________ | |
\ | |
\ | |
.... | |
....' | |
.... |
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
cp /usr/local/etc/dnsmasq.conf /usr/local/etc/dnsmasq.conf.orig | |
echo "conf-dir=/usr/local/etc/dnsmasq.d/,*.conf" | tee /usr/local/etc/dnsmasq.conf |
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 Microsoft.AspNetCore.Mvc; | |
using Microsoft.AspNetCore.Mvc.Infrastructure; | |
using Microsoft.Extensions.Options; | |
public class ConfigureMvcOptions : IConfigureOptions<MvcOptions> | |
{ | |
private readonly IHttpRequestStreamReaderFactory readerFactory; | |
public ConfigureMvcOptions(IHttpRequestStreamReaderFactory readerFactory) | |
{ |
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 record TSDemoInput(string Name); | |
public class TSDemoInputType : InputObjectType<TSDemoInput> | |
{ | |
protected override void Configure(IInputObjectTypeDescriptor<TSDemoInput> descriptor) | |
{ | |
descriptor.Field(input => input.Name) | |
.Type<TrimmedStringType>(); | |
} | |
} |
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
#! /bin/bash | |
# checkout-pull-prune.sh | |
branchName=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p') | |
git checkout "$branchName" && \ | |
git pull && \ | |
git fetch --prune |
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
#! /bin/bash | |
branchName=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p') | |
git checkout "$branchName" \ | |
| git branch --merged \ | |
| grep -E --invert-match "(^\*|master|main|dev)" \ | |
| xargs git branch --delete \ | |
&& git remote prune origin |
OlderNewer