Skip to content

Instantly share code, notes, and snippets.

will@RubyBuntu:~ [ruby-1.9.2-p0@default]
$ gem i mongrel
Building native extensions. This could take a while...
ERROR: Error installing mongrel:
ERROR: Failed to build gem native extension.
/home/will/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
checking for main() in -lc... yes
creating Makefile
using NUnit.Framework;
public abstract class CollectionViewBaseTests
{
// abstract factory method
public abstract CollectionViewBase GetView();
[Test]
public void HasDisposableEditorManager()
{
@hotgazpacho
hotgazpacho / FNHMappingExample.cs
Created October 25, 2010 13:53
Abstract base class with multiple subclasses. Some subclasses have additional properties in DetailXXX tables. DB lacks FK relationships. Relationships are mapped on "natural" composite keys.
// Component is an abstract base class
// Weld inherits from Component
// Weld has additional properties in DetailWeld table
public class ComponentMap : ClassMap<Component>
{
public ComponentMap()
{
Table("Component");
CompositeId().KeyProperty(x => x.ItemId).KeyProperty(x => x.RevNo);
C:\Dev\AutoTest.Net>build
NAnt 0.86 (Build 0.86.3412.0; nightly; 5/5/2009)
Copyright (C) 2001-2009 Gerry Shaw
http://nant.sourceforge.net
Buildfile: file:///C:/Dev/AutoTest.Net/build/default.build
Target framework: Microsoft .NET Framework 3.5
Target(s) specified: go
DataTableReader dataReader = dataTable.CreateDataReader();
return Mapper.Map<IDataReader, IEnumerable<T>>(dataReader);
C:\Dev\AutoMapper [(v1.1)]> .\go.bat
NAnt 0.86 (Build 0.86.2898.0; beta1; 12/8/2007)
Copyright (C) 2001-2007 Gerry Shaw
http://nant.sourceforge.net
Buildfile: file:///C:/Dev/AutoMapper/AutoMapper.build
Target framework: Microsoft .NET Framework 3.5
Target(s) specified: test
@hotgazpacho
hotgazpacho / twitter_followers.rb
Created February 15, 2011 05:32
Where are my twitter followers?
require 'yajl'
require 'twitter'
# Configure twitter
# Need to create an App with twitter first
# Your OAuth tokens can then be found by clicking "My Access Token"
Twitter.configure do |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
@hotgazpacho
hotgazpacho / gist:829333
Created February 16, 2011 13:04
Using the XmlUpdate task from MSBuild Community Tasks
<Import Project=".\MSBuild.Community.Tasks.Targets"/>
<PropertyGroup>
<Company>My Company</Company>
<Product>My Product</Product>
<Version>1.0.0.0</Version>
</PropertyGroup>
<Target Name="UpdateBuildInfo">
<XmlUpdate XmlFileName=".\_BuildInfo.xml" XPath="//buildInfo/projectName" Value="$(Product)" />
<XmlUpdate XmlFileName=".\_BuildInfo.xml" XPath="//buildInfo/companyName" Value="$(Company)" />
<XmlUpdate XmlFileName=".\_BuildInfo.xml" XPath="//buildInfo/version" Value="$(Version)" />
@hotgazpacho
hotgazpacho / GenericRepositoryRegistrationConvention.cs
Created February 23, 2011 15:47
A StructureMap IRegistrationConvention for mapping IRepository<T> to GenericRepository<T>
using System;
using MyApplication.Domain;
using MyApplication.Persistence;
using StructureMap.Configuration.DSL;
using StructureMap.Graph;
namespace MyApplication
{
public class GenericRepositoryRegistrationConvention : IRegistrationConvention
{
@hotgazpacho
hotgazpacho / gist:864022
Created March 10, 2011 12:20
Transform T4 templates outside Visual Studio
<Target Name="TransformT4Templates">
<ItemGroup>
<T4Templates Include="..\**\*.tt" />
</ItemGroup>
<Exec WorkingDirectory="$(CommonProgramFiles)\Microsoft Shared\TextTemplating\1.2"
Command="TextTransform &quot;%(T4Templates.FullPath)&quot;" />
</Target>