Skip to content

Instantly share code, notes, and snippets.

@mikelheim
mikelheim / parseISO8601
Created February 19, 2014 07:34
JavaScript function to set ISO date format reliably for across browsers. Resolves a problem with ie8 javascript date parser: http://stackoverflow.com/questions/12305039/net-webapi-iso-datetime-and-ie8
/**Parses string formatted as YYYY-MM-DDThh:mm:ss.sZ
* or YYYY-MM-DDThh:mm:ssZ (for IE8), to a Date object.
* If the supplied string does not match the format, an
* invalid Date (value NaN) is returned.
* @param {string} dateStringInRange format YYYY-MM-DDThh:mm:ss.sZ,
* or YYYY-MM-DDThh:mm:ssZ - Zulu (UTC) Time Only,
* with year in range of 0000-9999, inclusive.
* @return {Date} Date object representing the string.
*/
@mikelheim
mikelheim / Transpose2dArray
Created February 19, 2014 07:24
takes 2D array of any type and returns a transposed 2D array of same type. Vb.Net Function
Function Transpose2dArray(Of Array)(ByVal inArray As Array(,)) As Array(,)
Dim x = CInt(inArray.GetLength(1))
Dim y = CInt(inArray.GetLength(0))
Dim outArray(x - 1, y - 1) As Array
For i = 0 To x - 1
For j = 0 To y - 1
outArray(i, j) = inArray(j, i)
Next
Next