Skip to content

Instantly share code, notes, and snippets.

David Mohundro drmohundro

Block or report user

Report or block drmohundro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@drmohundro
drmohundro / gist:114239
Created May 19, 2009
Implementation of Blog entity for use with NHibernate
View gist:114239
public class Blog
{
public virtual int Id { get; set; }
public virtual bool AllowsComments { get; set; }
public virtual string Title { get; set; }
public virtual string Subtitle { get; set; }
public virtual DateTime CreatedAt { get; set; }
}
@drmohundro
drmohundro / gist:114241
Created May 19, 2009
Mapping for Blog with Fluent NHibernate
View gist:114241
public class BlogMap : ClassMap<Blog>
{
public BlogMap()
{
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.Title);
Map(x => x.Subtitle);
Map(x => x.AllowsComments);
Map(x => x.CreatedAt);
}
@drmohundro
drmohundro / gist:114242
Created May 19, 2009
Fluent NHibernate version of Ayende's InMemoryDatabaseTest
View gist:114242
public class InMemoryDatabaseTest : IDisposable
{
private static Configuration _configuration;
private static ISessionFactory _sessionFactory;
protected ISession _session;
public InMemoryDatabaseTest(Assembly assemblyContainingMappedType)
{
if (_configuration == null)
_sessionFactory = CreateSessionFactory(assemblyContainingMappedType);
@drmohundro
drmohundro / gist:114244
Created May 19, 2009
Unit test to go along with Fluent NHibernate version of InMemoryDatabaseTest
View gist:114244
[TestFixture]
public class BlogTests : InMemoryDatabaseTest
{
public BlogTests() : base(typeof(Blog).Assembly)
{
}
[Test]
public void Can_save_and_load_blog()
{
@drmohundro
drmohundro / Get-ConsoleColors.ps1
Last active Dec 15, 2015
PowerShell snippet to output all colors.
View Get-ConsoleColors.ps1
[Enum]::GetNames([System.ConsoleColor]) |
foreach {
$foregroundColor = $_
$backgroundColor = 'Black'
if ($_ -eq 'Black') {
$backgroundColor = 'White'
}
Write-Host -foregroundcolor $foregroundColor -backgroundColor $backgroundColor $foregroundColor
@drmohundro
drmohundro / Get-DevLinkAgenda.ps1
Last active Dec 21, 2015
Simple PowerShell script to pull the DevLink agenda.
View Get-DevLinkAgenda.ps1
# NOTE: Only worked for DevLink 2013
$agenda = Invoke-RestMethod http://www.devlink.net/agenda.json
$speakers = Invoke-RestMethod http://www.devlink.net/speakers.json
$location = Invoke-RestMethod http://www.devlink.net/api/info/locations.json
$fullAgenda = $agenda | foreach {
# normalize the times to be datetime types
$startTime = ([DateTimeOffset]::Parse($_.start_time)).DateTime
$endTime = ([DateTimeOffset]::Parse($_.end_time)).DateTime
@drmohundro
drmohundro / attribute-parse.swift
Last active Aug 29, 2015
SWXMLHash Attribute Search Example
View attribute-parse.swift
var data = "<Conversations>" +
"<Conversation id=\"ConvTest1\">" +
"<StartingStatementId>1</StartingStatementId>" +
"<Description>Some description 1</Description>" +
"</Conversation>" +
"<Conversation id=\"ConvTest2\">" +
"<StartingStatementId>2</StartingStatementId>" +
"<Description>Some description 2</Description>" +
"</Conversation>" +
"</Conversations>"
@drmohundro
drmohundro / private.xml
Last active Sep 21, 2017
Karabiner private.xml to swap option and command keys for Parallels
View private.xml
<?xml version="1.0"?>
<root>
<appdef>
<appname>PARALLELS</appname>
<equal>com.parallels.desktop.console</equal>
</appdef>
<devicevendordef>
<vendorname>MICROSOFT</vendorname>
<vendorid>0x045e</vendorid>
@drmohundro
drmohundro / example.swift
Created Nov 26, 2014
SWXMLHash parsing XML with namespace
View example.swift
// Playground - noun: a place where people can play
import SWXMLHash
import UIKit
let xmlWithNamespace = "<root xmlns:h=\"http://www.w3.org/TR/html4/\"" +
" xmlns:f=\"http://www.w3schools.com/furniture\">" +
" <h:table>" +
" <h:tr>" +
" <h:td>Apples</h:td>" +
@drmohundro
drmohundro / Get-FrameworkVersions.ps1
Last active Jun 4, 2018
PowerShell script to return all installed .NET Framework versions.
View Get-FrameworkVersions.ps1
<#
.Synopsis
Returns the install .NET Framework versions.
.Description
The script looks through the registry using the notes from the below
MSDN links to determine which versions of .NET are installed.
You can’t perform that action at this time.