Skip to content

Instantly share code, notes, and snippets.

@dvhthomas
dvhthomas / Markdown.sublime-build
Created May 3, 2011 22:58
Pandoc powered Sublime Text 2 build provider for Markdown files: HTML the easy way
{
"cmd": ["pandoc.exe", "--to=html", "--output=$file.html", "$file"],
"selector": "source.md"
}
@dvhthomas
dvhthomas / param.cs
Created May 3, 2011 22:26
Parameterized Oracle queries in .NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Oracle.DataAccess;
using Oracle.DataAccess.Client;
using System.Data;
namespace Oracle
{
<Component Id="ImportDirectory" Guid="{382E974D-69C6-4dc5-B2DD-FC8C8F5D5688}">
<CreateFolder/>
<!-- Note the goofy escaping of square brackets in the XPath -->
<util:XmlFile Id="ModifyImportLocation"
Action="setValue"
ElementPath="//configuration/appSettings/add[\[]@key='ImportHoldingArea'[\]]/@value"
File="[IMPORTLOCATION]\FcaImportService.exe.config"
Value="[IMPORTHOLDINGAREA]"/>
</Component>
<ServiceInstall Id="ImporterService"
Name="FcaImport"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]"
DisplayName="DoDEA Importer"
Type="ownProcess"
ErrorControl="normal"
Description="Windows service to reconcile uploaded field edits with the central application database"
Start="auto"
Interactive="no"/>
<Directory Id="IMPORTLOCATION" Name="FCA Importer">
<!-- Windows Service that actually imports data from uploaded files to the server db -->
<Component Id="ImportWindowsService" Guid="{87477BBB-E01D-4aa6-8E57-0262F17B40CA}">
<CreateFolder/>
<File Id="_7za.exe1" Source="$(var.DoDEA.Sync.ImportService.TargetDir)\7za.exe" />
<File Id="DoDEA.FCA.Services.dll1" Source="$(var.DoDEA.Sync.ImportService.TargetDir)\DoDEA.FCA.Services.dll" />
<File Id="DoDEA.Sync.Client.dll1" Source="$(var.DoDEA.Sync.ImportService.TargetDir)\DoDEA.Sync.Client.dll" />
<File Id="FcaImportService.exe" Source="$(var.DoDEA.Sync.ImportService.TargetPath)" />
</Component>
@dvhthomas
dvhthomas / EventListener.cs
Created December 6, 2009 22:44
NHibernate event listener
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using NHibernate.Event;
using StructureMap;
namespace *****.Core.Persistence
{
/// <summary>
@dvhthomas
dvhthomas / ZipTest.cs
Created November 21, 2009 00:22
Testing the 7zip implementation
[Test]
public void Compressing_file_in_non_working_directory_zips_the_right_files()
{
const string zipFile = "archive.7z";
const string fileToCompress = "sample.jpg";
DirectoryInfo directoryInfo = new DirectoryInfo(@"..\..\..\..\");
Console.Write(directoryInfo.FullName);
Assert.IsTrue(directoryInfo.Exists);
FileInfo zipTarget = new FileInfo(Path.Combine(directoryInfo.FullName, zipFile));
@dvhthomas
dvhthomas / SevenZip.cs
Created November 21, 2009 00:17
7zip compression utility
using System;
using System.ComponentModel;
using System.IO;
using Woolpert.Common;
using Woolpert.Logging;
namespace Woolpert.Compression
{
/// <summary>
/// Zips up files and folders using 7-Zip, a command line tool with speed
@dvhthomas
dvhthomas / IFileZipUtility.cs
Created November 21, 2009 00:12
Core Zipping interfaces
using System;
using System.IO;
namespace Woolpert.Compression
{
/// <summary>
/// Zips files up
/// </summary>
public interface IFileZipUtility
{
@dvhthomas
dvhthomas / RubyBlue.vssettings
Created November 17, 2009 00:07
Ruby Blue theme for VS2008
<UserSettings>
<ApplicationIdentity version="9.0"/>
<ToolsOptions>
<ToolsOptionsCategory name="Environment" RegisteredName="Environment"/>
</ToolsOptions>
<Category name="Database Tools" RegisteredName="Database Tools">
<Category name="T-SQL Editor" RegisteredName="T-SQL Editor"/>
</Category>
<Category name="Environment_Group" RegisteredName="Environment_Group">
<Category name="Environment_FontsAndColors" Category="{1EDA5DD4-927A-43a7-810E-7FD247D0DA1D}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_FontsAndColors" PackageName="Visual Studio Environment Package">