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
Common.context('#news-page', function($) { | |
console.log(this.html()); | |
}); | |
// output: | |
// <div id="#news-page"> | |
// <h2>Australian broadband news and information</h2> | |
// <p>Friday round-up</p> |
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
// By JonathanConway.net | |
// Based off original code by Andy E. http://stackoverflow.com/questions/901115/get-querystring-values-with-jquery/2880929#2880929 | |
Object.prototype.isArray = function () { | |
/// <summary> | |
/// Returns true if this object is an array. | |
/// </summary> | |
return !(this.push === undefined); | |
}; |
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
jQuery.extend(jQuery.expr[':'], { | |
/// <summary> | |
/// Filter out checkboxes which are checked. | |
/// </summary> | |
checked: function(element) { | |
return element.checked; | |
} | |
}); |
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 ValidationExtensions | |
{ | |
public static MvcHtmlString ValidationMessageHtmlFor<TModel, TProperty>( | |
this HtmlHelper<TModel> htmlHelper, | |
Expression<Func<TModel, TProperty>> expression, | |
bool htmlEncode) | |
{ | |
return new MvcHtmlString( | |
HttpUtility.HtmlDecode( | |
htmlHelper.ValidationMessageFor<TModel, TProperty>( |
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
$.extend($.expr[':'], { | |
/// <summary> | |
/// Filters on whether the element has the same css property & value as specified. | |
/// Example: $('a:css(color:blue)') returns only links which are blue. | |
/// </summary> | |
css: function(element, index, params) { | |
var style = params[3].split(':'); | |
return element.style[style[0]] === style[1]; | |
} | |
}); |
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
Number.prototype.between = function(n1, n2) { return this >= n1 && this <= n2; } |
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
Number.prototype.times = function(fn) { for (var i = 0; i < this; i++) { fn(i); } } |
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.preBind = function(type, data, fn) { | |
var currentBindings = this.data('events')[type]; | |
var currentBindingsLastIndex = currentBindings.length - 1; | |
var newBindings = []; | |
// bind the event | |
this.bind(type, data, fn); | |
// move the new event to the top of the array | |
newBindings.push(currentBindings[currentBindingsLastIndex]); |
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
CREATE PROC InsertGenerator | |
(@tableName varchar(100)) as | |
--Declare a cursor to retrieve column specific information | |
--for the specified table | |
DECLARE cursCol CURSOR FAST_FORWARD FOR | |
SELECT column_name,data_type FROM information_schema.columns | |
WHERE table_name = @tableName |
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 TypeExtensions | |
{ | |
/// <summary> | |
/// Determine whether a type is simple (String, Decimal, DateTime, etc) | |
/// or complex (i.e. custom class with public properties and methods). | |
/// </summary> | |
/// <see cref="http://stackoverflow.com/questions/2442534/how-to-test-if-type-is-primitive"/> | |
public static bool IsSimpleType( | |
this Type type) | |
{ |
OlderNewer