Skip to content

Instantly share code, notes, and snippets.

View tncbbthositg's full-sized avatar

D. Patrick Caldwell tncbbthositg

View GitHub Profile
public class ComparerProxy<T> : IComparer<T>
{
private readonly IComparer<T>[] _comparers;
public ComparerProxy(params IComparer<T>[] comparers)
{
_comparers = comparers;
}
public int Compare(T x, T y)
require 'net/http'
def vote()
result = Net::HTTP.get("www.someplace.com", "/voteCounter.php?voteFor=2", 80);
# the results look like this:
# total=6091&votesOption1=2791&votesOption2=2920&votesOption3=380
matches = /votesOption1=(\d*)&votesOption2=(\d*)/i.match(result);
o1 = matches[1].to_i();
o2 = matches[2].to_i();
<configuration>
<appSettings>
<ConfigSection>Patrick</ConfigSection>
<Patrick.Name.First>Patrick</Patrick.Name.First>
<Patrick.Name.Last>Caldwell</Patrick.Name.Last>
<Patrick.Gender>Male</Patrick.Gender>
<James>
<Name>
@tncbbthositg
tncbbthositg / XMLConfigurationProvider.cs
Created May 6, 2009 21:15
ESG.Utilities.ConfigurationHelper.XmlConfigurationProvider
using System.Collections.Specialized;
using System.Configuration;
using System.Xml;
using System.IO;
using System;
namespace ESG.Utilities.ConfigurationHelper
{
public class XmlConfigurationProvider : IConfigurationProvider
{
using System.Collections.Specialized;
using System.Configuration;
namespace ESG.Utilities.ConfigurationHelper
{
public interface IConfigurationProvider
{
NameValueCollection AppSettings { get; }
ConnectionStringSettingsCollection ConnectionStrings { get;}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<TestSettings.ClassToTest>FSDM</TestSettings.ClassToTest>
<TestSettings.FSDM.Assembly>FileSystemDocumentManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TestSettings.FSDM.Assembly>
<TestSettings.FSDM.TypeName>FileSystemDocumentManagement.FileSystemDocumentManager</TestSettings.FSDM.TypeName>
<Patrick.BaseFolderLocation>C:\temp\PatrickBase</Patrick.BaseFolderLocation>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<TestSettings>
<ClassToTest>FSDM</ClassToTest>
<FSDM>
<Assembly>FileSystemDocumentManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</Assembly>
<TypeName>FileSystemDocumentManagement.FileSystemDocumentManager</TypeName>
</FSDM>
@tncbbthositg
tncbbthositg / gist:108443
Created May 7, 2009 22:37
Using ConfigurationProvider with collections
Dictionary<string, string> configuration = GetConfiguration();
IConfigurationProvider provider = new ConfigurationProvider(configuration);
ConfigurationHelper helper = new ConfigurationHelper(provider, path);
public class DictionaryCache<TObject>
{
// hide the constructor
private DictionaryCache() { }
public static Dictionary<string, TObject> Cache
{
get
{
return Session[CacheType.Name] as Dictionary<string, TObject>;
CREATE TRIGGER Benefits.AddressHashcode
ON Benefits.Addresses
INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO addresses
SELECT City, State, Zip, Street1, Street2, County,
ISNULL(