Skip to content

Instantly share code, notes, and snippets.

@ToJans
ToJans / fizzbuzz.cs
Last active December 10, 2015 10:08
Pattern matching in c#
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Toopsie.Parsers;
namespace Toopsie.Specs
{
[TestClass]
public class PatternMatchFizzbuzz
{
@ToJans
ToJans / blogconvert.erl
Created January 15, 2013 23:39
Going to convert my blog to github-pages using an erlang-app :/
-module(blogconverter)
-export([convert/2,convert/3])
convert(UrlFrom,UrlTo) ->
convert(UrlFrom,UrlTo,jekyll);
convert(UrlFrom,UrlTo,Format) ->
savePosts(fetchPosts(UrlFrom),UrlTo,Format).
fetchPosts(Url) ->
@ToJans
ToJans / CustomResponseHandler.cs
Last active December 13, 2015 16:58
Simple custom response handler for SelfHostHttp, with a reverse proxy (currently not async)
public class CustomResponseHandler : DelegatingHandler
{
public List<Func<HttpRequestMessage, HttpResponseMessage>> ContentProviders { get; private set; }
public CustomResponseHandler()
{
ContentProviders = new List<Func<HttpRequestMessage, HttpResponseMessage>>();
ContentProviders.Add(GetResult);
}
@ToJans
ToJans / proxy specs.cs
Last active December 14, 2015 11:58
Who can tell me why fiddler https proxying gives a timeout and http does not.....
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shouldly;
using System;
using System.Net;
using System.Net.Security;
namespace NetVCR.Specs
{
[TestClass]
public class Verify_basic_proxy_functionality
@ToJans
ToJans / authentication.coffee
Last active December 14, 2015 21:38
Zombify demo I'm currently using for a client POC
Client = require './client'
System = require './system'
should = require 'should'
client = new Client()
system = new System()
Feature "Authentication",
"As a site owner",
Browser = require('zombie')
class Client
is_defined = (what) -> what != null && typeof what isnt 'undefined'
constructor: (base) ->
@base = base
@browser = new Browser()
@ToJans
ToJans / gist:5169008
Created March 15, 2013 10:54
Apparently there is a problem with the zip for windows? unzipping it gives me a crc error on phantomjs.exe, and npm install phantomjs fails
Microsoft Windows [versie 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Alle rechten voorbehouden.
C:\data>npm install phantomjs
npm http GET https://registry.npmjs.org/phantomjs
npm http 200 https://registry.npmjs.org/phantomjs
npm http GET https://registry.npmjs.org/phantomjs/-/phantomjs-1.8.2-0.tgz
npm http 200 https://registry.npmjs.org/phantomjs/-/phantomjs-1.8.2-0.tgz
npm http GET https://registry.npmjs.org/unzip
npm http GET https://registry.npmjs.org/rimraf
set path=%path%;c:\Program Files\erl5.10.1\bin
@ToJans
ToJans / bus.erl
Last active December 17, 2015 14:19
A bus thath generates a process per AR instance and sends messages to it
-module(bus).
-compile(export_all).
% Public interface
start(RouteResolver) ->
Pid = spawn_link(?MODULE,loop,{RouteResolver,dict:new()}),
register(bus,Pid).
stop() ->
@ToJans
ToJans / gist:5635808
Created May 23, 2013 12:48
Mijn klant in Limburg is op zoek naar .Net devs in VAST dienstverband
Keywords zijn:
- C# 4.0
- Linq
- ASP.NET MVC 2 & 3
- Javascript
- HTML
- XML
- Ajax
- Jquery
- JSON