This file contains hidden or 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 PascalCaseToDisplayNameFilter : IModelMetadataFilter | |
{ | |
public void TransformMetadata(System.Web.Mvc.ModelMetadata metadata, IEnumerable<Attribute> attributes) | |
{ | |
if (!string.IsNullOrEmpty(metadata.PropertyName) && !attributes.OfType<DisplayNameAttribute>().Any()) | |
{ | |
metadata.DisplayName = metadata.PropertyName.ToStringWithSpaces(); | |
} | |
} | |
} |
This file contains hidden or 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; | |
using System.Data.Common; | |
using System.Data.Entity.Migrations; | |
using TestingEntityFramework.Core.Extensions; | |
using TestingEntityFramework.Data; | |
using TestingEntityFramework.Data.Migrations; | |
namespace TestingEntityFramework.Tests.Helpers | |
{ | |
public class TestDataContextFactory |
This file contains hidden or 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.Linq; | |
using System.Web.Mvc; | |
namespace Gabe.Web.Common | |
{ | |
/// <summary> | |
/// Use this for getting constructor injected dependencies on IActionFilters. | |
/// </summary> | |
/// <typeparam name="TFilterAttr"></typeparam> | |
/// <remarks> |
This file contains hidden or 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
.something-semantic { | |
display: table; | |
width: 100%; | |
} | |
.something-else-semantic { | |
display: table-cell; | |
text-align: center; | |
vertical-align: middle; | |
} |
This file contains hidden or 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 HandleDomainEventsScanner : IRegistrationConvention | |
{ | |
public void Process(Type type, Registry registry) | |
{ | |
foreach(var interfaceType in type.GetInterfaces() | |
// see https://gist.github.com/gabrieljoelc/5706069 for IsGenericTypeAssignableFrom() extension method | |
.Where(t => typeof(IHandleDomainEvents<>).IsGenericTypeAssignableFrom(t))) | |
registry.AddType(interfaceType, type)); | |
} | |
} |
This file contains hidden or 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
[Test] | |
public void CreateName_AddsCurrentTimeAtEnd() | |
{ | |
using (Clock.NowIs(new DateTime(2010, 12, 31, 23, 59, 00))) | |
{ | |
string name = new ReportNameService().CreateName(...); | |
Assert.AreEqual("name 2010-12-31 23:59:00", name); | |
} | |
} |
This file contains hidden or 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
# if message doesn't contain max retry info then | |
# publish to delay (dead-letter) queue with first step | |
# elsif message contains retry info that's not max then | |
# update retry step and publish to delay dead-letter queue | |
# else | |
# send to error (dead-letter) queue |
This file contains hidden or 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
describe Book do | |
it "glorifies published at" do | |
book = Book.new | |
def book.published_at | |
Time.new(2012, 1, 2) | |
end | |
book.glorified_published_at.must_equal "The most awesome and first Monday of the glorious year of 2012" | |
end |
This file contains hidden or 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
module ActsAsOwned | |
def acts_as_owned(options = {}) | |
raise 'Must define owner lambda' unless options[:owner] && options[:owner].class == Proc | |
define_method(:owner, &options[:owner]) | |
end | |
end | |
ActiveRecord::Base.send :extend, ActsAsOwned |
This file contains hidden or 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
export PATH=/usr/local/bin:$PATH | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi | |
export PATH="$HOME/bin:$PATH" | |
export PATH="/Applications/Postgres.app/Contents/Versions/9.3/bin:$PATH" | |
source ~/.git-prompt.sh |