Skip to content

Instantly share code, notes, and snippets.

View timgthomas's full-sized avatar

Tim G. Thomas timgthomas

View GitHub Profile
@timgthomas
timgthomas / Using a Custom Fluent NHibernate Type.cs
Created August 31, 2010 19:17
Define a custom SQL type in a Fluent NHibernate mapping file
public class FooMap : ClassMap<Foo>
{
public FooMap()
{
Table("Foo");
Id(f => f.Id, "Id").GeneratedBy.Identity();
Map(f => f.CustomField).CustomSqlType("varchar (60)");
}
}
@timgthomas
timgthomas / index.html
Created January 24, 2011 21:43
Using CSS to create an image banner within an H1 tag
<!DOCTYPE html>
<html lang="en">
<body>
<h1>My Site</h1>
<p>Lorem ipsum...</p>
</body>
</html>
@timgthomas
timgthomas / Metadata.cs
Created March 7, 2011 19:40
Using a metadata class to provide attributes to properties in another part of the same (partial) class
[MetadataType(typeof(PersonMetadata))]
public partial class Person
{
public class PersonMetadata
{
[Required]
public string Name { get; set; }
}
}
@timgthomas
timgthomas / gist:995657
Created May 27, 2011 16:46
Using GetFields() to return a comma-separated list of fields on an object.
public string GetFieldNames(Type type)
{
return string.Join(",", GetFields(type).Select(t => t.Name).ToArray());
}
public static IEnumerable<FieldInfo> GetFields(Type currentType)
{
foreach (FieldInfo fi in currentType.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
{
if (!(typeof(Delegate)).IsAssignableFrom(fi.FieldType)) yield return fi;
a.button {
background: #222;
border: solid 1px #666;
color: #666;
}
a.button:hover {
background: #06a;
border: solid 1px #fff;
color: #fff;
.transition {
-moz-transition: all 0.5s ease; /* Firefox */
-o-transition: all 0.5s ease; /* Opera */
-webkit-transition: all 0.5s ease; /* Safari and Chrome */
-ms-transition: all 0.5s ease; /* Internet Explorer */
transition: all 0.5s ease;
}
@timgthomas
timgthomas / AdminAreaRegistration.cs
Created January 31, 2012 16:55
DoddleReport with MVC Areas
using System.Web.Mvc;
using DoddleReport.Web;
namespace Product.Web.Areas.Admin
{
public class AdminAreaRegistration : AreaRegistration
{
public override string AreaName
{
get { return "Admin"; }
/* Coins */
body { background: #ccb; }
.coin {
display: inline-block;
}
.coin:after {
content: ' ';
background: #f0f;
border-radius: 50%;
/* Coins */
@import url(http://fonts.googleapis.com/css?family=IM+Fell+English);
body {
background: url('http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/bedge_grunge_@2X.png');
background-size: 50%;
cursor: default;
}
.price {
/* Coins */
@import url(http://fonts.googleapis.com/css?family=IM+Fell+English);
body {
background: url('http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/bedge_grunge_@2X.png');
background-size: 50%;
cursor: default;
}
.price {