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 static class MassiveExtensions | |
{ | |
// Extension method that coverts an concrete object to a dynamic object. When using massive, this is helpful | |
// to auto-convert concrete objects while skipping over key fields that would otherwise throw an | |
// error (such as ID's) | |
public static dynamic ToExpando(this object o, params string[] propertiesToIgnore) | |
{ | |
var result = new ExpandoObject(); | |
var d = result as IDictionary<string, object>; //work with the Expando as a Dictionary | |
if (o.GetType() == typeof(ExpandoObject)) return o; //shouldn't have to... but just in case |
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
// Using Knockout and Tablesorter is a little tricky due to the fact that | |
// knockout tends to have a slight delay in load (if you are making an ajax call) | |
// and that table sorter likes to cache its value. To make them work together, | |
// on need to pay attention to execution order... | |
// | |
// Credit: Steve Sanderson http://bit.ly/H1B2Jm | |
// When binding your table, be sure to use the postAction event on the data-bind | |
// attribute to call the tablesorter() update method on your view: | |
// |
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
// Used to give an observable the ability to track whether or not its | |
// values have been changed. Adapted from a few blog posts: | |
// http://www.knockmeout.net/2011/05/creating-smart-dirty-flag-in-knockoutjs.html | |
// http://schinckel.net/2012/01/14/knockoutjs-dirty-extender./ | |
// | |
// Requires: knockout.js, knockout.js mapping extension | |
ko.extenders.dirty = function(target) { | |
var cleanValue = ko.observable(ko.mapping.toJSON(target)); | |
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
#OS junk files | |
[Tt]humbs.db | |
*.DS_Store | |
#Visual Studio files | |
*.[Oo]bj | |
*.user | |
*.aps | |
*.pch | |
*.vspscc |