Skip to content

Instantly share code, notes, and snippets.

@kirandasika
kirandasika / BypassIECompatForIntranet.md
Last active September 18, 2015 19:51
Bypassing the "Display intranet sites in Compatibility View"

In order to bypass the Display intranet sites in Compatibility View setting in the IE > Compatibility View Settings, you can set the following <meta> tag as high as possible in the <head> section.

<meta http-equiv ="X-UA-Compatible" content ="IE=edge">
@kirandasika
kirandasika / IntellisenseForLog4net.md
Created September 18, 2015 15:38
Intellisense for log4net in Visual Studio
  • Download the log4net schema from here
  • Add this .xsd to Visual Studio menu > XML > Schemas

Note that the XML menu item would be enabled only if an xml or a .config file is opened in the editor.

@kirandasika
kirandasika / SQLServerBITemplatesForVS2013.md
Last active September 18, 2015 15:34
How to make SQL Server BI templates available in VS2013 and VS2015
@kirandasika
kirandasika / localjQueryFallback.html
Created April 3, 2015 22:10
A quick way to fallback to local jQuery library if Google CDN is not available
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"></script>')</script>
@kirandasika
kirandasika / getFullYear.md
Last active September 18, 2015 19:55
Use getFullYear() instead of getYear() to get the 4 digit year value from the date object #JavaScript

getYear() is deprecated and is replaced by getFullYear()

getYear() is working for IE8, but it is broken for IE10.

For the Date object created by new Date("10/10/2013"), when you use getYear() IE8 returns 2013, but IE10 returns 113.

Inorder to get the 4-digit year value, you need to use the getFullYear() function.

@kirandasika
kirandasika / isValidDate.js
Last active August 29, 2015 14:17
Validate a date string #JavaScript
// Validates whether the given date string is in MM/DD/YYYY format, and if it is a valid date.
var isValidDate = function (dateString) {
// Validate the date string for the format via regular expressions. In this case it is MM/DD/YYYY
var dateRegEx = new RegExp('^(0?[1-9]|1[012])/(0?[1-9]|[12][0-9]|3[01])/((19|20)\\d\\d)$' ); // Date Format: MM/DD/YYYY
if (dateRegEx.test(dateString)) {
var dateTokens = dateString.split('/' );
var timestamp = Date.parse(dateString);
// Parsing the date in javascript into the no. of milliseconds since Jan 1, 1970 is
// an added line of defense to check whether the date format is correct.
if (!isNaN(timestamp)) {