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
export default function debounce(fn, delay) { | |
var timeoutID = null; | |
return function () { | |
clearTimeout(timeoutID) | |
var args = arguments; | |
var that = this; | |
timeoutID = setTimeout(function () { | |
fn.apply(that, args) | |
}, delay) |
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.Builder; | |
using Microsoft.AspNetCore.Http; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
namespace UI.Middleware | |
{ | |
public class CustomHeadersMiddleware | |
{ | |
private RequestDelegate _next; |
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 class CacheHelper | |
{ | |
static string KeyPrefix = "SkunkWorks_"; | |
private static IDatabase GetCache() | |
{ | |
var redis = ConnectionMultiplexer.Connect("lorem.ipsum.com:6379"); | |
//specify DB number here | |
return redis.GetDatabase(15); | |
} |
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.Collections.Generic; | |
using System.Data; | |
using System.Data.SqlClient; | |
using System.Linq; | |
using System.Web; | |
namespace WebDapper.Helpers | |
{ | |
public delegate void DBDelegate<T>(T dbCall); |
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
function KeyPress(e) { | |
//http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes | |
var evtobj = window.event? event : e | |
if (evtobj.keyCode == 90 && evtobj.ctrlKey) alert("Ctrl+z"); | |
} | |
document.onkeydown = KeyPress; |
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.Collections.Generic; | |
using System.Linq; | |
using System.ServiceModel; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace WCFActivator | |
{ | |
public class ServiceActivator<T> |
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 Order GetOrder(int id) | |
{ | |
using (var svc = SvcHelper.GetServiceClient<OrdersServiceClient, IOrdersService>(SvcHelper.ServiceURL.OrdersServiceURL)) | |
{ | |
try | |
{ | |
return svc.GetOrder(id, "en-us"); | |
} | |
catch (Exception) | |
{ |
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 ActionResult Upload() | |
{ | |
var file = @"C:\Users\adam.bezulski\Desktop\login-logo-freeway.png"; | |
var mongoServer = new MongoClient(ConfigurationManager.AppSettings["MongoHQ"].ToString()).GetServer(); | |
var db = mongoServer.GetDatabase("CarsMVC"); | |
using (var fs = new FileStream(file, FileMode.Open)) | |
{ | |
var options = new MongoGridFSCreateOptions { | |
UploadDate = DateTime.UtcNow |
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 string BaseLocale | |
{ | |
get | |
{ | |
switch (Locale.ToLower()) | |
{ | |
case "da-us": | |
return "da"; | |
case "de-us": | |
return "de"; |