Skip to content

Instantly share code, notes, and snippets.

@AdamAndersonFalafelSoftware
AdamAndersonFalafelSoftware / gist:0e32afb7790f1021c46b50a8650707a1
Created January 27, 2017 12:47
MemoryCache helper class async locking test
void Main()
{
var key1Task = new Task<string>(() => ExampleCache.GetItem("key1"));
var key2Task = new Task<string>(() => ExampleCache.GetItem("key2"));
key1Task.Start();
key2Task.Start();
Task.WaitAll(key1Task, key2Task);
key1Task.Result.Dump();
key2Task.Result.Dump();
}
public class TodoItemController : TableController<TodoItem>
{
protected override void Initialize(HttpControllerContext controllerContext)
{
base.Initialize(controllerContext);
MobileServiceContext context = new MobileServiceContext();
DomainManager = new EntityDomainManager<TodoItem>(context, Request, Services);
}
// GET tables/TodoItem
@AdamAndersonFalafelSoftware
AdamAndersonFalafelSoftware / jasmine-boot-console.js
Created October 19, 2014 12:39
Jasmine JS Chrome Console Reporter
/**
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
[jasmine-gem]: http://github.com/pivotal/jasmine-gem
jasmine-boot-console.js modifications by Adam Anderson, Falafel Software, 2014
@AdamAndersonFalafelSoftware
AdamAndersonFalafelSoftware / CredentialsAuthProviderWithAspnetMigration.cs
Created October 23, 2013 22:14
A custom ServiceStack CredentialsAuthProvider that automatically migrates user credentials from ASP.NET Membership when they attempt to log in
using ServiceStack.Common;
using ServiceStack.OrmLite;
using ServiceStack.ServiceInterface;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.WebHost.Endpoints;
using System;
using System.Data;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;