Skip to content

Instantly share code, notes, and snippets.

View randyburden's full-sized avatar

Randy Burden randyburden

View GitHub Profile
@randyburden
randyburden / CapitalizationHelper.cs
Created March 12, 2013 23:41
CapitalizationHelper intelligently capitalizes English names taking into account some common names that do not conform to the normal English capitalization rules.
using System;
using System.Globalization;
using System.Text.RegularExpressions;
namespace Utilities
{
/// <summary>
/// Provides intelligent capitalization methods.
/// </summary>
public static class CapitalizationHelper
@randyburden
randyburden / BooleanJsonConverter.cs
Created July 4, 2013 04:42
A Json.NET JsonConverter that can handle converting the following values into boolean values: true, false, yes, no, y, n, 1, 0.
using System;
using Newtonsoft.Json;
namespace JsonConverters
{
/// <summary>
/// Handles converting JSON string values into a C# boolean data type.
/// </summary>
public class BooleanJsonConverter : JsonConverter
{
@randyburden
randyburden / install.ps1
Created November 26, 2013 21:35
NuGet Installation Splash Page Script - Add this file under a folder named "tools" in the root of your NuGet package and it will open a splash web page upon package install. I have made the file more generic for better re-usability. Simply replace the $url variable value with your own URL and replace the $packageName variable value with the name…
param($installPath, $toolsPath, $package, $project)
# open splash page on package install
# don't open if it is installed as a dependency
# attribution: Modified from: https://github.com/JamesNK/Newtonsoft.Json/blob/master/Build/install.ps1
try
{
$url = "http://randyburden.com/Slapper.AutoMapper/"
$packageName = "slapper.automapper"
@randyburden
randyburden / DataTableMappingTestsWithSlapperAutoMapper.cs
Created December 18, 2013 20:37
Demonstrates converting a DataTable to a list of strongly typed objects using Slapper.AutoMapper.
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
namespace Atcs.Core.Tests
{
[TestFixture]
@randyburden
randyburden / TimeSpanHelper.cs
Last active February 14, 2023 19:25
TimeSpan helper and extension method for creating a formatted string of a given TimeSpan. Supports up to microsecond resolution. Also includes unit tests.
using System;
using System.Text;
namespace Helpers
{
public static class TimeSpanHelper
{
/// <summary>
/// Gets a formatted string of the given <see cref="TimeSpan"/>. Supports up to microsecond resolution.
///
@randyburden
randyburden / TestHelper.CodeGenerator.cs
Created February 4, 2014 22:12
A little test helper code generator class that will script out some C# for a given type. It is meant to help aid in generating boilerplate unit test code.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using NUnit.Framework;
namespace TestHelper
{
[TestFixture]
@randyburden
randyburden / CodeMirror_CurlyBraceWrappedText_Demo
Created October 21, 2014 23:21
CodeMirror Custom Syntax Highlighter for highlighting double curly brace wrapped text aka Mustache / Handlebars
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CurlyBraceWrappedText Demo</title>
<style type="text/css">
.CodeMirror {border: 1px solid black;}
.cm-CurlyBraceWrappedText {color: #CC0000; font-weight: bold;}
</style>
<link rel="stylesheet" href="css/codemirror.css">
@randyburden
randyburden / OwinRequestExtensions.cs
Created October 22, 2014 00:40
OwinRequest extensions for getting query string, form body, and header parameters as Dictionary<string,string>
/// <summary>
/// Owin Request extensions.
/// </summary>
public static class OwinRequestExtensions
{
/// <summary>
/// Gets the combined request parameters from the form body, query string, and request headers.
/// </summary>
/// <param name="request">Owin request.</param>
/// <returns>Dictionary of combined form body, query string, and request headers.</returns>
@randyburden
randyburden / gist:192944935ba2360e3e0b
Created October 31, 2014 04:47
Paper Weight Chart
Paper Weight Chart
------------------
16 lb bond - 60 g/m2
17 lb bond - 64 g/m2
18 lb bond - 64 g/m2 or 67.7 g/m2 or 69 g/m2
19 lb bond - 71 g/m2 or 74 g/m2 or 75 g/m2
20 lb bond - 74 g/m2 or 75 g/m2 or 75.2 g/m2 or 80 g/m2
24 lb bond - 90 g/m2
@randyburden
randyburden / PdfSharpExtensions.cs
Created November 2, 2014 21:30
PdfSharp extensions for adding a 2D DataMatrix barcode to a PdfPage using the IEC16022Sharp library to generate the 2D barcode image.
namespace PDFMerger.Utilities
{
/// <summary>
/// Provides extension methods for PdfSharp objects.
/// </summary>
public static class PdfSharpExtensions
{
/// <summary>
/// Adds a 2D DataMatrix barcode to the PdfPage.
/// </summary>