Skip to content

Instantly share code, notes, and snippets.

@codelinq
codelinq / setter_pattern.coffee
Created August 9, 2012 14:57 — forked from alexaivars/setter_pattern.coffee
Getter Setter patter for Coffeescript
Function::define = (prop, desc) ->
Object.defineProperty this.prototype, prop, desc
class GetterSetterTest
constructor: (@_obj = {}) ->
# 'obj' is defined via the prototype, the definition proxied through
# to 'Object.defineProperty' via a function called 'define' providing
# some nice syntactic sugar. Remember, the value of '@' is
# GetterSetterTest itself when used in the body of it's class definition.
@codelinq
codelinq / ActionSample.cs
Created June 13, 2011 01:20
Is this too much code in an action?
public ViewResult Search(Guid customerId)
{
SearchModel model = _menuTasks.GetDefaultSearchModelFor(_sessionData.UserId, customerId);
model.Results = _menuTasks.Search(model);
var customer = _customerTasks.GetCustomerInformationModelForCustomer(customerId);
ViewData["Menu"] = new PresentationMenuModel { BusinessName = customer.Name };
ViewData["hide-option-tab"] = true;
return View("Search", model);
public class SystemUser
{
public Guid Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string IsActive { get; set; }
}
@codelinq
codelinq / EFCachingCommand.cs
Created January 26, 2011 20:30
Make EFCachingProvider Support ambient transactions via TransactionScope.
public sealed class EFCachingCommand : DbCommandWrapper
{
// Modified this method to update the EFCachingEnlistment if it exists.
private void UpdateAffectedEntitySets()
{
if (this.transaction != null)
{
if (this.Definition.IsModification)
{