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 | |
ResolveReferences - To resolve references in JSON object with circular references. | |
*/ | |
function ResolveReferences(json) { | |
if (typeof json === 'string') | |
json = JSON.parse(json); | |
var byid = {}, // all objects by id | |
refs = []; // references to objects that could not be resolved |
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
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
/* | |
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
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
/* | |
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
/* | |
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# Generic String Parser Extension Method | |
Code Snippet By: Pinal Bhatt [www.PBDesk.com] | |
http://blogs.pbdesk.com/c-generic-string-parser-extension-method/ | |
Working Example at http://ideone.com/ZP5xo | |
Usage: | |
string s = "32"; | |
int i = s.As<int>(); | |
*/ |
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
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote | |
#Set of commands i use to rename feature/15.0 to feature/SignupRefactor locally and remotely | |
#rename local feature/15.0 to feature/SignupRefactor | |
git branch -m feature/15.0 feature/SignupRefactor | |
#delete remote feature/15.0 |
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 urlLib = require('url'); | |
function UrlAdapter(urlString) { | |
this.urlObj = urlLib.parse(urlString, true); | |
// XXX remove the search property to force format() to use the query object when transforming the url object to a string | |
delete this.urlObj.search; | |
} | |
exports.UrlAdapter = UrlAdapter; |
OlderNewer