This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| // Load jQuery | |
| (function () { | |
| var jq = document.createElement('script'); jq.type = 'text/javascript'; jq.async = true; | |
| jq.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js'; | |
| var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(jq, s); | |
| })(); |
This file contains hidden or 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
| // Needs reference to 'http://maps.google.com/maps/api/js?sensor=false'. Optional: '&language=en'. | |
| // mapElement should contain a 'data-locations'-attribute with JSON-formatted objects | |
| // with properties 'lat', 'long', 'title' and optional 'description' | |
| var initMap = function (mapElement) { | |
| var dataLocations = $(mapElement).attr('data-locations'); // Find DOM-attribute containing locations | |
| var markerPositions = ($.parseJSON(dataLocations) || { locations: [] }).locations || []; | |
| var latlng = new google.maps.LatLng(59.33279, 18.06449); |
This file contains hidden or 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 string ToAbsolute(this UrlHelper urlHelper, string appRelativeUrl, | |
| string relativeHostName = null, bool? useSecureConnection = null) { | |
| var httpContext = urlHelper.RequestContext.HttpContext; | |
| if(string.IsNullOrWhiteSpace(relativeHostName) && httpContext.Request == null) { | |
| throw new ArgumentException("The provided host-name cannot be null or empty if there is no current HttpContext.", "relativeHostName"); | |
| } | |
| relativeHostName = (relativeHostName ?? string.Empty).Trim(new[] { '/' }); | |
| if(!Uri.IsWellFormedUriString(relativeHostName, UriKind.Relative)) { |
This file contains hidden or 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
| // According to: | |
| // http://www.ietf.org/rfc/rfc3986.txt | |
| public static char[] ValidRfc3986Chars = new[] { | |
| 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z', | |
| 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', | |
| '0','1','2','3','4','5','6','7','8','9', | |
| '-','.','_','~',':','/','?','#','[',']','@','!','$','&','\'','(',')','*','+',',',';','=', | |
| }; |
This file contains hidden or 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
| Sub ConvertWordsToPdfs() | |
| Dim directory As String | |
| directory = "C:\Wordup" ' The starting directory | |
| Dim fso, folder, files | |
| Set fso = CreateObject("Scripting.FileSystemObject") | |
| Set folder = fso.GetFolder(directory) | |
| Set files = folder.files |
NewerOlder