This file contains 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
/// <summary> | |
/// Return the expression text | |
/// </summary> | |
/// <typeparam name="TModel"></typeparam> | |
/// <param name="expression"></param> | |
/// <returns></returns> | |
public static string GetExpressionText<TModel>(Expression<Func<TModel, object>> expression) | |
{ | |
var expr = (LambdaExpression)expression; | |
if (expr.Body.NodeType == ExpressionType.Convert) |
This file contains 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
/** | |
* Check if a word or phrase is a palindrome in 106 characters of JavaScript. | |
*/ | |
function isPalindrome(s) { | |
return s.match(/[a-zA-Z]/g).join('').toLowerCase()==s.match(/[a-zA-Z]/g).reverse().join('').toLowerCase(); | |
} |
This file contains 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
/** | |
* Convert an hexadecimal value in a integer base-10. | |
* @param hex An hexadecimal value to convert. | |
* @return An integer base-10 equivalent to the given hexadecimal value. | |
*/ | |
function hex2int(hex) { | |
return parseInt(hex, 16); | |
} |
NewerOlder