Skip to content

Instantly share code, notes, and snippets.

@ToJans
ToJans / jabbr.js
Created January 27, 2012 12:34
ClientSidePlugins for jabbr
interceptor.plugins.push({
description: "Typing ZOMG will be expanded to the full expression",
filter: /\b(zomg)\b/gi,
func: function (input, match) {
return input.replace(/\bzomg\b/i, 'Zombies Ohh My Gawd !!!');
}
});
@ToJans
ToJans / Examples.cs
Created January 30, 2012 14:46
NancyFX extension method to get remapped url
return Response.AsRedirect(request.Url.Remap(scheme="https").ToString());
return Response.AsRedirect(request.Url.Remap("~/Retry/").WithQueryParameter("Message","Invalid blah").ToString());
@ToJans
ToJans / KeyValueStore.cs
Created February 23, 2012 12:03
NOSQL for SQLServer etc
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using Microsoft.CSharp.RuntimeBinder;
using Newtonsoft.Json;
namespace Blommekes.Infrastructure
{
@ToJans
ToJans / fizzbuzz.fs
Created March 14, 2012 15:45
F# Experiments
[1..100] |> Seq.map(function
| x when x % 15 = 0 -> "FizzBuzz"
| x when x % 3 = 0 -> "Fizz"
| x when x % 5 = 0 -> "Buzz"
| x -> string x) |> Seq.iter(printfn "%s");;
@ToJans
ToJans / 0.Account.cs
Created March 19, 2012 20:24
YakShayQRS RinatMode
public class Account
{
// virtual props define the unique id, are used as a message filter
// and initialized upon loading the instance
protected virtual string AccountId { get; set; }
bool IsRegistered = false;
private Decimal Balance = 0;
// public non-virtual methods define the external interface (i.e. the commands);
@ToJans
ToJans / linkskes.md
Created March 27, 2012 06:17
Linkskes
@ToJans
ToJans / Odd.cs
Created April 14, 2012 19:36
Problem with couchbase
using System;
using System.Linq;
using CouchBasePerf.Domain;
using Enyim.Caching.Memcached;
namespace CouchBasePerf.Handlers
{
public class HandlerBase
{
protected Couchbase.CouchbaseClient client = new Couchbase.CouchbaseClient();
@ToJans
ToJans / Program.cs
Created May 18, 2012 18:56
Heracles - The Paycento Builder
namespace Heracles
{
class Program
{
static void Main(string[] args)
{
var CheckOutFolder = Heracles.Properties.Settings.Default.CheckoutFolder;
var LibsToCopyFolder = Tools.LocalPath("libs");
var TargetLibsToCopyFolder = Path.Combine(CheckOutFolder, "libs");
var buildfolder = Path.Combine(CheckOutFolder, "build");
@ToJans
ToJans / 01.What.txt
Created May 23, 2012 15:08
How we perform integration testing at Paycento
This is how we currently run integration tests for Paycento
===========================================================
More info: ToJans@twitter
This is what happens when we type "Heracles test" on the command line.
- It downloads the source from svn if it is not available yet
- It copies some external dependencies from a subfolder to the source
- It build the solutions & copies the builds in a build folder
- It deploys web projects to a local folder
@ToJans
ToJans / MerchantSpeed.cs
Created May 31, 2012 19:56
Here is how we track our progress for the performance improvements over at Paycento
// TJS 2012/05/31 11:05 14 tx/sec
[TestMethod]
public void CreateSessionKeySpeed()
{
// restores a new private MSSQL db from backup and injects it into the self-hosted WCF backend API
using (var ApiCtx = new PaycentoAPIContext())
{
// we have access to the db instance as well
ApiCtx.RunOnDb(dbconn => {
var cmd = dbconn.CreateCommand();