This file contains 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.Linq; | |
using System.Text; | |
namespace System.IO | |
{ | |
public static class StreamExtensions | |
{ | |
public static Endianness Endianness = Endianness.BigEndian; |
This file contains 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.IO; | |
using System.Net.Http; | |
using System.Net.Http.Formatting; | |
using System.Net.Http.Headers; | |
using System.Reflection; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace WebApi.Formatters |
This file contains 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
///<summary> Checks whether the JSON <paramref name="content"/> as <paramref name="resultType"/> contains the entities described in the given <paramref name="table"/> </summary> | |
private static string[] VerifyJsonContent(string content, string resultType, Table table) | |
{ | |
var matchingTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetExportedTypes()) | |
.Where(t => (t.Namespace + "." + t.Name).EndsWith(resultType)).ToArray(); | |
if (matchingTypes.Length != 1) return new[] { string.Format("Cannot determine matching type by the name {0}; candidates: [{1}]", | |
resultType, string.Join(", ", matchingTypes.Select(t => t.Namespace + "." + t.Name))) }; | |
object message = null; |
This file contains 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 System.Collections.Generic | |
{ | |
using System.Linq; | |
public sealed class CircularBuffer<TItem> : IList<TItem>, ICollection<TItem>, IEnumerable<TItem> | |
{ | |
private int count = 0; | |
private int offset = 0; | |
private readonly TItem[] buffer; |
This file contains 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.Linq.Expressions; | |
using System.Threading; | |
namespace Cancelable | |
{ | |
public struct CancelableActionCall<TS> | |
{ | |
private readonly TS _svc; | |
private readonly CancellationToken _token; |
This file contains 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.Globalization; | |
using System.Linq; | |
using System.Reflection; | |
using System.Threading; | |
namespace System.Data | |
{ | |
public static class SqlClientExtensions |
This file contains 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
// based on: https://www.gentoo.org/proj/en/base/embedded/handbook/?part=1&chap=5 | |
// build as: gcc -static qemu-arch-cpu.c -O3 -s -o /usr/bin/qemu-arch-cpu | |
// use like: ln -s /usr/bin/qemu-arch-cpu /usr/bin/qemu-arm-arm1176 | |
#include <malloc.h> | |
#include <string.h> | |
#include <unistd.h> | |
char** parse_tuple(char* tuple) { | |
int pos = 0; |
This file contains 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
[System.Diagnostics.DebuggerStepThrough] | |
public static string ReadPassword(char maskChar = '*') | |
{ | |
var password = string.Empty; | |
var categories = new[] { UnicodeCategory.Control, UnicodeCategory.Format, UnicodeCategory.OtherNotAssigned, UnicodeCategory.PrivateUse, UnicodeCategory.Surrogate }; | |
for (var key = Console.ReadKey(true); key.Key != ConsoleKey.Enter; key = Console.ReadKey(true)) | |
{ | |
if (!categories.Contains(CharUnicodeInfo.GetUnicodeCategory(key.KeyChar))) | |
{ | |
password = string.Concat(password, key.KeyChar); |
This file contains 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.Linq.Expressions; | |
namespace TechTalk.SpecFlow.ObjectVerification | |
{ | |
public static class CollectionVerifierExtensions | |
{ | |
/// <summary> |
This file contains 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.ComponentModel; | |
using System.Linq.Expressions; | |
namespace TechTalk.SpecFlow.ObjectVerification | |
{ | |
public static class ObjectVerifierExtensions | |
{ | |
/// <summary> |
NewerOlder