`
文章列表

CSS Reset

Purpose:   To dismiss problems that may be caused by browsers’ default style. We use a css script to override the default style, so that they will behave all the same in different kind of browsers.   Examples:   1. Most commonly used: *{ margin:0; padding: 0; } It will dismiss most o ...
  $eval()==>$digest() $updateView()==>$apply() which will cause $root.$digest() $onEval(function(){})==>$watch(function(){})  
Problems: We want to keep the content displayed center vertically in one container(div, a, p, span etc). The contents' height is less than the container's height. height: 28px; font-size: 12px;  Quite strange, the content will keep displayed at the top as below.      Even if we use ...
Cheat sheet for C# regular expressions metacharacters, operators, quantifiers etc (?i) within the pattern begins case-insensitive matching, (?-i) ends it.   Character Description \ Marks the next character as either a special character or e ...

favicon

  <link href="http://www.apple.com/favicon.ico" rel="icon" type="image/x-icon">  
Problems: We want to display something like this. The container has images on the left and right, with absolute position. The contents text is in the middle.   Solution: We have an <a> as the container. A <span>for the shopping chart image and <b> for the arrow right. T ...
Problems: We want to keep the content displayed center horizontally in one container(div, p etc).     Solution: We can use auto margin to center the element like below.   <div id="container"> <div id="center"><img src="./images/T1qjOGXaRqXXXX ...
Problem: The <pre> tag of html is used to keep the format of the content as it is inputted. So, if the content is a long line of text with no line break, then it will displayed as one line and can be out of the container's scope. Even if we've already applied " word-wrap: break-word;&qu ...
Attached is the code to show the memory leak in ie8 for angularjs.   1. performance.html is for angularjs. Keep refreshing by pressing f5 would see a dramatically memory rise. 2. performance2.html is for jquery. Keep refreshing by pressing f5 would not see memory rise. That demonstrate that this i ...
  //parse_url /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/ //ignore case, the other two flags are 'g', 'm' /^abc$/i "into".match(/in|int/) \d is same as [0-9], \D is same as [^0-9] \s is same as[\f\n\r\t...], \S is same as[ ...
function bind(self, fn) { var slice = [].slice; var curryArgs = arguments.length > 2 ? slice.call(arguments, 2, arguments.length) : []; if (typeof fn == "function" && !(fn instanceof RegExp)) { return curryArgs.length ? function() { ...
What happened behind "AllDeleteOrphan" mapping in NHibernate? Suppose we have the following mapping for Person and FamilyMember. We expect FamilyMember to be removed from db when we remove it from the person.   [HasMany(typeof(FamilyMember), Cascade = ManyRelationCascadeEnum.AllDeleteOrp ...
  The default hot key Ctrl+space is used by switch input method. So we need to reset it.   Menu-->tools-->options-->Environment-->Keyboard-->"Show commands containing"   Choose ReSharper.ReSharper_CompleteCodeSmart.   Bind the hot key you like.   For unit test, Choo ...

C# reflection

    博客分类:
  • .net
Sample code:   object.GetType().GetProperties(); property.GetValue(request, null); targetProperty.SetValue(object, value, null); Type listType = typeof(List<>);  //If the property is a list with generic type, return the generic type private static Type GetGenericInnerType(Proper ...
String.prototype.format = function () { var formatted = this; for (var i = 0; i < arguments.length; i++) { var regexp = new RegExp('\\{' + i + '\\}', 'gi'); formatted = formatted.replace(regexp, arguments[i]); } return formatted; };  
Global site tag (gtag.js) - Google Analytics