Skip to content

Instantly share code, notes, and snippets.

View randyburden's full-sized avatar

Randy Burden randyburden

View GitHub Profile
@randyburden
randyburden / C# Web Servers.md
Created February 2, 2015 00:20
Links to various implementations of C# Web Servers
@randyburden
randyburden / Node Videos Ive Watched.md
Created February 2, 2015 02:04
Node Videos I've Watched

##Node Videos I've Watched: Some good, some meh..

###Node.js Tutorial with Ryan Dahl, creator of Node.js Video Published 02/22/2011 | Video Length: 1:06:33

https://www.youtube.com/watch?v=eqlZD21DME0

###Ryan Dahl - History of Node.js Video Published 10/05/2011 | Video Length: 1:03:40

@randyburden
randyburden / AddConnectionStringAtRuntime.cs
Created March 23, 2015 17:06
Enables adding a ConnectionString at runtime
// Enables adding a ConnectionString at runtime
typeof ( ConfigurationElementCollection )
.GetField( "bReadOnly", BindingFlags.Instance | BindingFlags.NonPublic )
.SetValue( ConfigurationManager.ConnectionStrings, false );
@randyburden
randyburden / DynamicallyLoadedJsonNetSerializer.cs
Last active August 29, 2015 14:19
Provides methods for serializing and deserializing JSON by using the Newtonsoft.Json aka JSON.NET library which is loaded dynamically via reflection.
using System;
using System.Reflection;
namespace ReflectionExample
{
/// <summary>
/// Provides methods for serializing and deserializing JSON by using the Newtonsoft.Json aka JSON.NET library
/// which is loaded dynamically via reflection.
/// </summary>
/// <remarks>
@randyburden
randyburden / HttpClient.js
Created May 11, 2015 03:52
Simple JavaScript HTTP Client. Supports GET and POST.
httpClient = {
get: function( url, data, callback ) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
var readyState = xhr.readyState;
if (readyState == 4) {
callback(xhr);
}
@randyburden
randyburden / NanoWindowsServiceExample.cs
Created October 20, 2015 14:35
This is a working example of using the Nano micro web framework hosted as a Windows Service using the System.ServiceProcess .NET dependency to create a low dependency, low memory footprint website or web API.
using System;
using System.Diagnostics;
using System.Threading;
using Nano.Web.Core;
using Nano.Web.Core.Host.HttpListener;
namespace NanoWindowsServiceExample
{
public class Program
{
@randyburden
randyburden / InjectAppNameIntoConnectionString.cs
Last active January 11, 2016 19:53
Inject Application Name Into ConnectionString
public string GetConnectionString( string connectionStringName, string applicationName )
{
var connectionString = ConfigurationManager.ConnectionStrings[ connectionStringName ];
var builder = new System.Data.SqlClient.SqlConnectionStringBuilder( connectionString );
// Inject application name into connection string
if ( String.IsNullOrWhiteSpace( builder.ApplicationName ) )
{
if ( String.IsNullOrWhiteSpace( applicationName ) == false )
@randyburden
randyburden / NameGenerator.cs
Created September 5, 2016 06:38
A C# helper class for generating random first names and random last names.
using System;
namespace Helpers
{
/// <summary>
/// Name Generator.
/// </summary>
public static class NameGenerator
{
// List of the top 40 boy and girl baby names of 2016
@randyburden
randyburden / SocialSecurityNumberGenerator.cs
Created September 5, 2016 06:41
A C# helper class for generating random USA Social Security numbers. This was used in automated unit tests.
using System;
namespace Helpers
{
/// <summary>
/// Social Security Number Generator.
/// </summary>
public static class SocialSecurityNumberGenerator
{
/// <summary>
@randyburden
randyburden / VbaProject.OTM
Created September 30, 2016 16:25
Outlook VBA Scripts for Adding Categories to New Emails
Public Sub ShowCategoriesDialog()
Dim Mail As Object
Set Mail = Application.ActiveInspector.CurrentItem
Mail.ShowCategoriesDialog
End Sub
Public Sub AddAwaitingFeedbackCategory()
Dim Mail As Object
Set Mail = Application.ActiveInspector.CurrentItem
Mail.Categories = "Awaiting Feedback"