Skip to content

Instantly share code, notes, and snippets.

;//
// Grid extension.
// Adds default grid state perservation via localStorage.
// The grid container can specify a storage location by
// setting the data-store attribute to either:
// - local [default]
// - session
// - false Disables storage for this grid.
//
(function ($, kendo) {
@leniency
leniency / gist:4677093
Created January 30, 2013 21:17
An XML serialization helper that includes a serializer cache when targeting heirarchies.
/// <summary>
/// Delegate for events during the serializer cache.
/// </summary>
public delegate void SerializerCacheDelegate();
/// <summary>
/// XML serialization helper
/// </summary>
public static class Xml
{
@leniency
leniency / basic_grid.sass
Created April 1, 2012 16:58
Much of 960 Grid System in SASS
/*--------------------------------------------------------------------------------------*/
/* a quick way I like to use 960.gs, instead of having html classnames like .grid_5, etc.
/*-------------------------------------------------------------------------------------*/
// self-explanatory defaults
$_containerwidth: 960px
$_columns: 16
$_gutter: 10px
$_colspan: ($_containerwidth / $_columns)
$_colwidth: ( $_colspan - (2 * $_gutter))
@leniency
leniency / PermissionHelper.cs
Created March 13, 2012 15:38
Helper class for checking controller permissions.
/// <summary>
/// Helper methods for checking permissions on a controller.
/// </summary>
internal static class PermissionsHelper
{
/// <summary>
/// Internal IsAuthorized helper
/// </summary>
/// <param name="context"></param>
/// <param name="targetControllerType"></param>
@leniency
leniency / IQueryableExtensions.cs
Created August 1, 2011 22:31
Modifications to allow CamelCase.NestedProperties
/// <summary>
/// Provides projection mapping from an IQueryable sourceto a target type.
///
/// This allows from strongly-typed mapping and querying only necessary fields from the database.
/// It takes the place of Domain -> ViewModel mapping as it allows the ViewModel to stay as
/// IQueryable. AutoMapper works on in-memory objects and will pull all full records to perform
/// a collection mapping. Use AutoMapper for Input -> Domain scenarios, but not DAL.
///
/// Reference: http://devtrends.co.uk/blog/stop-using-automapper-in-your-data-access-code
/// </summary>