Skip to content

Instantly share code, notes, and snippets.

shanselman / gist:5422230
Last active May 23, 2022
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
View gist:5422230
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
simonech / CsvActionResult.cs
Created Nov 18, 2012
ActionResult for ASP.NET MVC that returns a CSV file from any list of objects
View CsvActionResult.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Reflection;
using System.Text;
using System.Web;
using System.Web.Mvc;
ardalis / Program.cs
Last active Sep 20, 2021
A StructureMap Example using a Console Application
View Program.cs
using System;
using System.Linq;
using StructureMap;
namespace ConsoleApplication1
/// <summary>
/// See
/// Updated for SM 4:
/// </summary>
codahale / pom.xml
Last active May 15, 2022
Take this and save it as pom.xml in your project directory.
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
<!-- none yet -->
rdingwall / DropAllRavenDatabases.bat
Created Feb 29, 2012
Fast Raven DB sandbox database helpers
View DropAllRavenDatabases.bat
@echo off
rem Warning: this batch file deletes ALL Raven DB data and databases, leaving you with a totally empty (but ready to use) Raven DB instance.
net stop RavenDB
rd /S /Q C:\RavenDB\Server\Data
rd /S /Q C:\RavenDB\Server\Tenants
net start RavenDB
bgrins / gist:1789787
Created Feb 10, 2012
C# Multipart File Upload
View gist:1789787
// Implements multipart/form-data POST in C#
public static class FormUpload
private static readonly Encoding encoding = Encoding.UTF8;
public static HttpWebResponse MultipartFormDataPost(string postUrl, string userAgent, Dictionary<string, object> postParameters)
string formDataBoundary = String.Format("----------{0:N}", Guid.NewGuid());
string contentType = "multipart/form-data; boundary=" + formDataBoundary;
View FindConflictingReferences.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
namespace MyProject
public class UtilityTest
brianlow / FindConflictingReferences.cs
Created Jan 3, 2012
Find conflicting assembly references
View FindConflictingReferences.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
namespace MyProject
mattwarren / gist:990623
Created May 25, 2011
Array patching with RavenDB
View gist:990623
using (var store = NewDocumentStore())
using (var s = store.OpenSession())
s.Store(new Post
//Create an empty list that we can add items to later
Comments = new List<Comment>()
View AutoMapperExtensions.cs
using System;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
namespace DovetailCRM.Core.Web.Mapping
public static class AutoMapperExtensions
public static void CreateMapsForSourceTypes(this IConfiguration configuration, Func<Type, bool> filter, Func<Type, Type> destinationType, Action<IMappingExpression, Type, Type> mappingConfiguration)