Skip to content

Instantly share code, notes, and snippets.

View .gitignore for C#
obj
bin
deploy
*.csproj.user
*.suo
*.cache
~$*
View hasdup.scheme
(define contains
(lambda (list item)
(and (not (null? list))
(or (= item (car list))
(contains (cdr list) item)))))
(define hasdup
(lambda (list)
(and (not (null? list))
(or (contains (cdr list) (car list))
@markrendle
markrendle / Git Bash.vbs
Created Nov 25, 2010
Modified Git Bash to use Console2
View Git Bash.vbs
Set AppObj = CreateObject("Shell.Application")
If WScript.Arguments.Length=1 Then
AppObj.ShellExecute "C:\Console2\Console.exe", " -t ""Git Bash"" -d """ & WScript.Arguments(0) & """"
Else
AppObj.ShellExecute "C:\Console2\Console.exe", " -t ""Git Bash"""
End If
View OverloadResolution.cs
using System;
namespace OverloadResolutionChallenge
{
class Program : One
{
static void Foo<T>(T? t = default(T?)) where T : struct
{
Console.WriteLine("struct");
}
@markrendle
markrendle / TaskEx.cs
Created Jun 14, 2011
DelayedStart extension for System.Threading.Tasks.Task
View TaskEx.cs
public static class TaskEx
{
private static readonly ConcurrentDictionary<Task, Timer> Timers = new ConcurrentDictionary<Task, Timer>();
public static Task DelayedStart(this Task task, TimeSpan delay)
{
var timer = new Timer(_ => Start(task), null, (long)delay.TotalMilliseconds, -1L);
Timers.AddOrUpdate(task, timer, (k, t) => t);
return task;
}
View ElegantCache.cs
namespace ElegantCache
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.Caching;
class ElegantCache<TValue> : IDisposable
@markrendle
markrendle / coffee.cmd
Created Oct 7, 2011
CoffeeScript compiler on Windows
View coffee.cmd
@echo off
"%PROGRAMFILES%/Node/node.exe" "%PROGRAMFILES%/CoffeeScript/bin/coffee" %*
View MaybeMonad.cs
namespace MaybeMonad
{
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
static class Monads
{
/// <summary>
@markrendle
markrendle / Output with 0.12.1.txt
Created Nov 30, 2011
Comparison of Simple.Data Bulk Insert with SQL Server Provider 0.12.1 and 0.12.2
View Output with 0.12.1.txt
00:00:16.9799819
00:00:17.1971797
00:00:18.0744958
00:00:19.1514537
00:00:17.3798541
@markrendle
markrendle / EnumerableOfOneTest.cs
Created Dec 9, 2011
Single-element enumerable comparison
View EnumerableOfOneTest.cs
namespace EnumerableOfOneTest
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
using System.Diagnostics;
class Program
{
You can’t perform that action at this time.