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
/* | |
C# Generic Enum Parser With Extension Methods | |
Code Snippet By: Pinal Bhatt [www.PBDesk.com] | |
*/ | |
public static class EnumUtils | |
{ | |
#region String to Enum |
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
/* | |
C# Some Handy String Extension Methods | |
Code Snippet By: Pinal Bhatt [www.PBDesk.com] | |
*/ | |
using System; | |
public static class StringExtensions | |
{ | |
/// <summary> |
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.Dynamic; | |
namespace WW.COM.Framework.WWConfiguration | |
{ | |
public class EnvSettings : DynamicObject | |
{ | |
private string Category { get; set; } | |
public EnvSettings() | |
{ |
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
/* | |
Javascript function to read QueryString parameters. | |
More details bloged at http://blog.pbdesk.com/2008/11/reading-query-string-with-javascript.html | |
JSFiddle: http://jsfiddle.net/PinalBhatt/sBkur/ | |
*/ | |
function GetQueryStringValue(parameterName) { | |
var objQRs = new Object(); | |
window.location.search.replace(new RegExp("([^?=&]+)(=([^&]*))?", "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 DeepCompare() { | |
var leftChain, rightChain; | |
function compare2Objects(x, y) { | |
var p; | |
// remember that NaN === NaN returns false | |
// and isNaN(undefined) returns true | |
if (isNaN(x) && isNaN(y) && typeof x === 'number' && typeof y === 'number') { | |
return true; |
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
/* | |
Clone Object in Javascript | |
*/ | |
function Clone(obj) { | |
// Handle the 3 simple types, and null or undefined | |
if (null == obj || "object" != typeof obj) return obj; | |
// Handle Date | |
if (obj instanceof Date) { | |
var copy = new Date(); |
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
/* | |
Javascript: Random Number between two integers | |
http://blogs.pbdesk.com/javascript-random-number-between-two-integers/ | |
*/ | |
function randomFromTo(from, to){ | |
return Math.floor(Math.random() * (to - from + 1) + from); | |
} | |
//Invocation: |
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 foo(age, isValid) | |
{ | |
a = typeof a !== 'undefined' ? a : 18; | |
b = typeof b !== 'undefined' ? b : false; | |
/* | |
rest function body here | |
*/ | |
} |
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 multiStr = "This is the first line" + | |
"This is the second line" + | |
"This is more..."; | |
//Alternate way to create multiline strings | |
var multiStr = "This is the first line \ | |
This is the second line \ | |
This is more..."; |
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
/* | |
isNumeric function in Javascript | |
*/ | |
function isNumeric(n) { | |
return !isNaN(parseFloat(n)) && isFinite(n); | |
} |