Skip to content

Instantly share code, notes, and snippets.

@tater9104
tater9104 / MassiveExtensions.cs
Last active January 16, 2023 00:55
A list of a few extension methods that I often use when working with massive.
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
@tater9104
tater9104 / Knockout_Tablesorter.js
Created March 30, 2012 21:52
Utilizing Knockout.JS & Tablesorter together.
// 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:
//
@tater9104
tater9104 / knockoutextensions.js
Created March 30, 2012 19:40
KnockoutJS IsDirty Extender
// 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));
@tater9104
tater9104 / gitingore_defaults
Created March 30, 2012 02:09
A quick dump of my starting gitignore settings. (shamelessly robbed from others)
#OS junk files
[Tt]humbs.db
*.DS_Store
#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc