This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Specialized; | |
using System.Configuration; | |
using System.Xml; | |
using System.IO; | |
using System; | |
namespace ESG.Utilities.ConfigurationHelper | |
{ | |
public class XmlConfigurationProvider : IConfigurationProvider | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Specialized; | |
using System.Configuration; | |
namespace ESG.Utilities.ConfigurationHelper | |
{ | |
public interface IConfigurationProvider | |
{ | |
NameValueCollection AppSettings { get; } | |
ConnectionStringSettingsCollection ConnectionStrings { get;} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dictionary<string, string> configuration = GetConfiguration(); | |
IConfigurationProvider provider = new ConfigurationProvider(configuration); | |
ConfigurationHelper helper = new ConfigurationHelper(provider, path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DictionaryCache<TObject> | |
{ | |
// hide the constructor | |
private DictionaryCache() { } | |
public static Dictionary<string, TObject> Cache | |
{ | |
get | |
{ | |
return Session[CacheType.Name] as Dictionary<string, TObject>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( |
OlderNewer