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
// Adapted from http://devio.wordpress.com/2011/01/21/get-name-of-nested-property-as-string-value/ | |
public static string GetPropertyName<T, TValue>(this T model, Expression<Func<T, TValue>> expression) where T : class | |
{ | |
var memberExpression = (MemberExpression)expression.Body; | |
var memberExpressionOrg = memberExpression; | |
var Path = ""; | |
while (memberExpression != null && memberExpression.Expression.NodeType == ExpressionType.MemberAccess) |
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
.input-validation-error | |
{ | |
border: 1px solid #ff0000; | |
background-color: #ffeeee; | |
} | |
span.input-validation-error { | |
border: none; | |
} |
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
(function ($) { | |
$.validator.addMethod("notequal", function (value, element, param) { | |
return this.optional(element) || value != $(param).val(); | |
}, "This has to be different..."); | |
$.validator.unobtrusive.adapters.add("notequal", ["field"], function (options) { | |
options.rules["notequal"] = options.params.field; | |
if (options.message) options.messages["notequal"] = options.message; | |
}); | |
})(jQuery); |
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
(function ($) { | |
$.fn.formatfilename = function (options) { | |
var settings = $.extend({ | |
'length': '40' | |
}, options); | |
return this.each(function () { | |
var $this = $(this); |
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
$.fn.autotab = function () { | |
var inputEvents = "input"; | |
if (!("oninput" in document || "oninput" in $("<input>")[0])) { | |
inputEvents += " keypress"; | |
} | |
return this.each(function () { | |
var $this = $(this); | |
$this.on(inputEvents, "input[maxlength]", function (e) { | |
var $this = $(this); | |
if ($this.attr("maxlength") <= $(this).val().length) { |
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
Function.prototype.inheritsFrom = function (base) { | |
this.prototype = Object.create(base.prototype); | |
this.prototype.constructor = this; | |
this.prototype._super = base.prototype; | |
return this; | |
}; | |
var Base = function () { | |
if (!(this instanceof Base)) | |
throw ('Constructor called without "new"'); |
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
cd "$(ProjectDir)Scripts" | |
node.exe r.js -o build.js |
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
function sortBy(sequence, sorters) { | |
return sequence.slice().sort(function (a, b) { | |
var comparison = 0; | |
for (var i = 0; i < sorters.length; ++i) { | |
comparison = sorters[i](a, b); | |
if (comparison !== 0) { | |
return comparison; | |
} | |
} | |
return comparison; |
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
<!DOCTYPE html> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta charset="utf-8" /> | |
<title></title> | |
<link rel="stylesheet" href="http://localtodos.com/todos.css" /> | |
</head> | |
<body> | |
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
function($http, $q) { | |
var cache = {}; | |
return { | |
get: function (force){ | |
var deferred = $q.defer(); | |
if(force || !cache['get']){ | |
return $http.get('/path/to/data').then(function(result){ |
OlderNewer