Skip to content

Instantly share code, notes, and snippets.

View taeber's full-sized avatar

Taeber Rapczak taeber

View GitHub Profile
@taeber
taeber / homm2.sh
Created June 24, 2013 14:52
Launch HOMM2 in separate X session
#!/bin/sh
# https://bbs.archlinux.org/viewtopic.php?id=150620
# xinit homm2.xinitrc -- :1
startx -- -depth 16 homm2.xinitrc :1
@taeber
taeber / ObjectHelper.cs
Last active June 20, 2019 15:38
To return any object as an Enumerable...
using System.Collections.Generic;
public static class ObjectHelper
{
public static IEnumerable<T> AsEnumerable<T>(this T self)
{
yield return self;
}
}
@taeber
taeber / AsyncLogger.cs
Created February 12, 2013 22:20
Asynchronous Logger using C# TPL
using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
public interface ILogger
{
void Log(string message);
}
class AsyncLogger : ILogger, IDisposable
@taeber
taeber / feecalc.php
Created November 14, 2012 02:50
PHP implementation of PayPal fee calculator
<?php
/// Start of a PayPal fee calculator that I'll probably never finish. :-[
/*
Given:
total(cost, fee) := cost + fee(cost)
fee(cost) := F + P*cost
F := $0.30
P := 2.9%
@taeber
taeber / Expect.cs
Created October 25, 2012 20:35
xUnit.net inspired ExpectedExceptionAttribute alternative for MSTest
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTests
{
/// <summary>
/// Fluent interface for expected exceptions.
/// </summary>
/// <example>
/// Expect.Exception(() => DoSomethingBad())