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 static class ServiceBusExtensions | |
{ | |
public static bool HasSubscribersFor<T>(this IServiceBus serviceBus, T message) | |
{ | |
IEnumerable<Action<object>> enumerable = serviceBus.OutboundPipeline.Enumerate(message); | |
return enumerable.Any(); | |
} | |
} |
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
<html> | |
<head></head> | |
<body> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function() { | |
$("button").click(function() { | |
$("form").append( | |
$("<input />") | |
.attr("type", "hidden") |
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
$(".container").each(function() { | |
var that = $(this); | |
that.find("img").load(function() { | |
that.append("<span>" + $(this).height() + "</span>"); | |
}); | |
}); |
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
var elementsToHash = function(elements) { | |
var hash = {}; | |
elements.each(function() { | |
var element = $(this); | |
hash[element.attr("name")] = element.val(); | |
}); | |
return hash; | |
} |
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 static class ConventionHelper | |
{ | |
public static string PluralUnderscore(string name) | |
{ | |
return Underscore(Inflector.Net.Inflector.Pluralize(name)); | |
} | |
public static string Underscore(string name) | |
{ | |
return Regex.Replace(name, "([a-z])([A-Z])", "$1_$2").ToLowerInvariant().Trim(); |
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 FluentNHibernate.Mapping; | |
using Custom.Domain; | |
using Custom.Mappings.UserTypes; | |
namespace Custom.Mappings | |
{ | |
public abstract class EntityMap<T> : ClassMap<T> where T : Entity | |
{ | |
protected EntityMap() | |
{ |
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
class Encrypted<T> | |
{ | |
readonly byte[] value; | |
T decrypted; | |
public Encrypted(byte[] value) | |
{ | |
this.value = value; | |
} |
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; | |
namespace Currying | |
{ | |
public static class Fn | |
{ | |
public static Func<Func<int>, Func<int>> Curry(Func<Func<int>, Func<int>> x, Func<Func<int>, Func<int>> y) | |
{ | |
return a => y(x(a)); | |
} |
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 static class ObjectSetterExtensions | |
{ | |
public static TValue SetProperty<T, TValue>(this T target, Expression<Func<T, TValue>> property, TValue value) | |
{ | |
var propertyName = property.GetPropertyName(); | |
var propertySetter = typeof (T).GetProperty(propertyName).GetSetMethod(true); | |
propertySetter.Invoke(target, BindingFlags.NonPublic, null, new object[] {value}, null); | |
return value; |
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
require 'fileutils' | |
require 'tmpdir' | |
include FileUtils | |
class TempDirectory | |
def self.scoped(root = TempDirectory.timestamp_directory_name) | |
temp_dir = new(root) | |
yield temp_dir if block_given? |
OlderNewer