Skip to content

Instantly share code, notes, and snippets.

View kwal's full-sized avatar

Matthew Kowalski kwal

  • Milwaukee, WI
View GitHub Profile
@kwal
kwal / RedisCache.cs
Created August 13, 2015 15:03
Redis Cache
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
public class RedisCache : ICache
{
private readonly IConfiguration _config;
@kwal
kwal / Timeout.cs
Last active August 29, 2015 14:27
Task Timeout
var cutoff = 30000;
using (var delayCancellation = new CancellationTokenSource())
{
var mainTask = Task.Run(() =>
{
// Whatever needs doing...
});
var delayTask = Task.Delay(cutoff, delayCancellation.Token).ContinueWith(async t =>
{
@kwal
kwal / loader.js
Last active August 29, 2015 14:21
Module Loader
var fs = require('fs'),
path = require('path');
module.exports = function(dir, ignore) {
var result = {};
loadModules(dir, result, ignore);
return result;
};
function convertToCamelCase(value) {