Skip to content

Instantly share code, notes, and snippets.

@d1820
d1820 / AWS_Aurora_DataAPI_Expression_Mappers.cs
Last active June 4, 2020 03:23
AWS Aurora DataAPI expression mappers - .Net Core 3.1
public static class ColumnTypes
{
public const int STRING = 12;
public const int BOOL = -7;
public const int TIMESTAMP = 93;
}
@d1820
d1820 / BuilderResult.cs
Last active November 27, 2023 22:17
.Net Controller Unit Test Mock Builder
using System.Security.Claims;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Moq;
namespace Infrastructure.Testing.Builders
{
public class BuilderResult : HttpContextBuilderResult
{
@d1820
d1820 / multifield.sort.js
Last active March 15, 2017 02:37
Cool multiple sort function found online, that also handles reverse sorting.
generateSortFn(props) {
return function (a, b) {
for (var i = 0; i < props.length; i++) {
var prop = props[i];
var name = prop.name;
var reverse = prop.reverse;
if (a[name] < b[name])
return reverse ? 1 : -1;
if (a[name] > b[name])
return reverse ? -1 : 1;
@d1820
d1820 / buffers.ts
Last active March 4, 2017 19:40
Circular and Memory Buffer Example
//taken from https://github.com/tomsmeding/circular-buffer/blob/master/index.js and modified
//new features:
//find()
//getKeys()
//getValues()
//Persistant Buffer new features
//find() - finds a value by key
//getKeys() - gets only the keys available
//getValues() - gets the values
//load() - loads a buffer for use (useful if coming from server or localstorage)