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 System; | |
using System.Web.WebPages; | |
public static class WebPageBaseExtensions | |
{ | |
public static HelperResult RenderSection(this WebPageBase page, string sectionName, Func<dynamic, HelperResult> defaultContents) | |
{ | |
if (page.IsSectionDefined(sectionName)) | |
{ | |
return page.RenderSection(sectionName); |
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
var timeoutId = 0; | |
var scrollEvent = function() { | |
alert('Scroll event was fired'); | |
}; | |
$(window).scroll(function () { | |
clearTimeout(timeoutId ); | |
timeoutId = setTimeout(scrollEvent, 500); | |
}); |
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
string currentAction = Convert.ToString(this.ViewContext.Controller.ValueProvider.GetValue("action").RawValue); | |
string currentController = Convert.ToString(this.ViewContext.Controller.ValueProvider.GetValue("controller").RawValue); | |
bool isIndexPage = currentAction.Equals("index", StringComparison.InvariantCultureIgnoreCase) | |
&& currentController.Equals("home", StringComparison.InvariantCultureIgnoreCase); |
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
var items = [ 'ABC', '123', 'BAA' ]; | |
items.sort(function (a, b) { | |
var aVal = a.val.toLowerCase(); | |
var bVal = b.val.toLowerCase(); | |
return ((aVal < bVal) ? -1 : ((aVal > bVal) ? 1 : 0)); | |
}); | |
var last = items[0]; | |
for (var i = 1; i < items.length; i++) { | |
var item = items[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
var isNumber = function(number) { | |
return !isNaN(parseFloat(number)) && isFinite(number); | |
}; | |
var isNumberOrEmpty = function(number) { | |
number = (number || 0).toString().replace(' ', '').replace(',', '.'); | |
return !isNaN(parseFloat(number)) && isFinite(number); | |
}; |
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 RouteCollectionAreasExtensions | |
{ | |
public static Route MapAreaRoute( | |
this RouteCollection routes, | |
string areaName, | |
string routeName, | |
string url, | |
object defaults = null, | |
object constraints = null, | |
string[] namespaces = null) |
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
console.log($().jquery); // Show original jQuery-version | |
// Closure | |
var $gs = $.getScript; | |
// http://api.jquery.com/jQuery.noConflict/ | |
// jQuery.noConflict( [removeAll] ) | |
// removeAll: A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). | |
$.noConflict(true); |
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 class FileSizeHelper | |
{ | |
private static readonly string[] Units = { "B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; | |
private static string GetReadableFileSize(long size) // Size in bytes | |
{ | |
int unitIndex = 0; | |
while (size >= 1024) | |
{ | |
size /= 1024; |
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 DateTime? TryGetAssemblyCreationDate(Assembly assembly) | |
{ | |
try | |
{ | |
return System.IO.File.GetCreationTime(assembly.Location); | |
} | |
catch | |
{ | |
return null; | |
} |
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
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. | |
Parser Error Message: Invalid or missing attributes found in the tagPrefix entry. For user control, you must also specify 'tagName' and 'src'. For custom control, you must also specify 'namespace', and optionally 'assembly'. |