Skip to content

Instantly share code, notes, and snippets.

@d1820
d1820 / AWS_Aurora_DataAPI_Expression_Mappers.cs
Last active Jun 4, 2020
AWS Aurora DataAPI expression mappers - .Net Core 3.1
View AWS_Aurora_DataAPI_Expression_Mappers.cs
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 May 16, 2020
.Net Controller Unit Test Mock Builder
View BuilderResult.cs
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 Mar 15, 2017
Cool multiple sort function found online, that also handles reverse sorting.
View multifield.sort.js
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 Mar 4, 2017
Circular and Memory Buffer Example
View buffers.ts
//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)