This file contains 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
// New attribute that is only usable at the method (action) level | |
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = true)] | |
public class ActionAuthorizeAttribute : AuthorizeAttribute { | |
} | |
// New attribute that is only usable at the class (controller) level | |
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)] | |
public class ControllerAuthorizeAttribute : AuthorizeAttribute | |
{ |
This file contains 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
[Subject(typeof (ListingController))] | |
public class When_loading_page_n_of_potential_listings : SpecFor<ListingController> | |
{ | |
static PaginatedQuery<ListingSearchCriteria> query; | |
static PaginatedQueryResult<ListingSearchModel> queryResult; | |
static JsonResult result; | |
Establish context = () => | |
{ | |
query = new PaginatedQuery<ListingSearchCriteria>(); |
This file contains 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
// Common IoC methods accessed via static gateway | |
public interface IIoCContainer | |
{ | |
T GetImplementationOf<T>(); | |
T GetImplementationOf<T>(string key); | |
object GetImplementationOf(Type typeToResolve); | |
IEnumerable<T> GetAllImplementationsOf<T>(); | |
} | |
// Container-specific implementation of IoC interface. When I used Windsor |
This file contains 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 interface ICommand<TRequestMessage, TResponseMessage> { | |
public TResponseMessage Execute(TRequestMessage message); | |
} | |
public CreateCustomerCommand: ICommand<CreateCustomerRequest, CreateCustomerResponse>{ | |
public CreateCustomerResponse Execute(CreateCustomerRequest message){ |
This file contains 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 SomeClass | |
def sumpm | |
puts "You found me!" | |
end | |
def singleton_class | |
class << self; self; end | |
end | |
def remove_method(method_name) |
This file contains 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
// Fails with unix transport error: http://a.yfrog.com/img535/4867/5qb.png | |
Task BuildTaskFromNode(XElement taskNode, int parentId) | |
{ | |
var id = Convert.ToInt32(taskNode.Attribute("id").Value); | |
var task = new Task() | |
{ | |
Type = taskNode.Name.LocalName, | |
Id = id, | |
ParentId = parentId, |
This file contains 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
// Create an observable for MouseLeftButtonDown | |
var mouseEvents = Observable.FromEvent<MouseButtonEventArgs> (mycontrol, "MouseLeftButtonDown"); | |
//Query the observable just to select the points | |
var points = from ev in mouseEvents | |
select ev.EventArgs.GetPosition(this); | |
//Show points in windows title when ever user presses the left mouse button | |
points.Subscribe(p => this.Title = "Location = " + p.X + ", " + p.Y); |
This file contains 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 'Albacore' | |
require 'fileutils' | |
class DeepCopy | |
include Logging | |
attr_accessor :source_dir, :dest_dir, :extensions, :includes, :excludes | |
def initialize | |
super() | |
@extensions = [] |
This file contains 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
dc = DeepCopy.new | |
dc.extensions = ["dll", "aspx", "ascx", "svc", "asmx", "ashx", "asax", "config", "xap", | |
"resx", "jpg", "gif", "png", "css", "js", "swf", "lic", "xml", "master", | |
"dic", "txt", "htm"] | |
dc.excludes = ["obj/**", "upload/**"] | |
dc.source_dir = web_src | |
dc.dest_dir = deploy_target | |
dc.copy |