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
| // binding for displaying money values | |
| ko.bindingHandlers.numericText = { | |
| update: function (element, valueAccessor, allBindingsAccessor) { | |
| var value = ko.utils.unwrapObservable(valueAccessor()); | |
| var precision = ko.utils.unwrapObservable(allBindingsAccessor().precision) || | |
| ko.bindingHandlers.numericText.defaultPrecision; | |
| if (value === undefined || value === null) { | |
| return; | |
| } | |
| var formattedValue = Number(value).toFixed(precision); |
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
| // Encoder for classifier | |
| function jquerySelectorEncode(nameToEncode) { | |
| var encodedString = nameToEncode.replace(/\./g, "\\."); | |
| encodedString = encodedString.replace(/\:/g, "\\:"); | |
| encodedString = encodedString.replace(/\\/g, "\\\\"); | |
| encodedString = encodedString.replace(/\#/g, "\\#"); | |
| encodedString = encodedString.replace(/\//g, "\\/"); | |
| encodedString = encodedString.replace(/\s/g, "\\"); | |
| encodedString = encodedString.replace(/\"/g, "\\\""); | |
| encodedString = encodedString.replace(/\'/g, "\\\'"); |
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
| function GetMatchingItemFromSelectables(item, selectablesList) { | |
| var chosenIndex = -1; | |
| if (item !== undefined && item !== null) { | |
| if (item.Key !== undefined) {//this section is deprecated, old way of doing selectables | |
| for (var t = 0; t < selectablesList.length; t++) { | |
| if (selectablesList[t].Key === item.Key) { | |
| return selectablesList[t]; | |
| } |
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
| SELECT * | |
| FROM sys.indexes | |
| WHERE | |
| --name='YourIndexName' AND | |
| object_id = OBJECT_ID('<SCHEMA>.<TABLE>') |
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 validation = { | |
| isEmailAddress:function(str) { | |
| var pattern =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; | |
| return pattern.test(str); // returns a boolean | |
| }, | |
| isNotEmpty:function (str) { | |
| var pattern =/\S+/; | |
| return pattern.test(str); // returns a boolean |
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
| ko.bindingHandlers.numericText = { | |
| update: function(element, valueAccessor, allBindingsAccessor) { | |
| var value = ko.utils.unwrapObservable(valueAccessor()); | |
| var precision = ko.utils.unwrapObservable(allBindingsAccessor().precision) || | |
| ko.bindingHandlers.numericText.defaultPrecision; | |
| if (value === undefined || value === null) { | |
| return; | |
| } | |
| var formattedValue = Number(value).toFixed(precision); | |
| ko.bindingHandlers.text.update(element, |
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
| function listAllProperties(o) { | |
| var objectToInspect; | |
| var result = []; | |
| for(objectToInspect = o; objectToInspect !== null; objectToInspect = Object.getPrototypeOf(objectToInspect)) { | |
| result = result.concat(Object.getOwnPropertyNames(objectToInspect)); | |
| } | |
| return result; | |
| } |
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
| function validateEmail() | |
| { | |
| var emailID = document.myForm.EMail.value; | |
| atpos = emailID.indexOf("@"); | |
| dotpos = emailID.lastIndexOf("."); | |
| if (atpos < 1 || ( dotpos - atpos < 2 )) | |
| { | |
| alert("Please enter correct email ID") | |
| document.myForm.EMail.focus() ; |
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
| (function(){ | |
| var toMoney = function(num){ | |
| if(num === null || num === undefined){ | |
| return 0; | |
| } | |
| // Use this if your number is a string: | |
| // return '$' + (Number(num).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') ); | |
| return '$' + (num.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') ); | |
| }; |
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
| function Encode(str) { | |
| // Rreplace every letter in the string with the letter following it | |
| // by first getting the charCode number of the letter, adding 1 to it, then | |
| // converting this new charCode number to a letter using the fromCharCode function | |
| // we also check to see if the character is z and if so we simply convert the z to an a | |
| var codedString = str.replace(/[a-z]/gi, | |
| function(char) { | |
| return (char === 'z' || char === 'Z') ? 'a' : String.fromCharCode(char.charCodeAt() + 1); | |
| }); |