среда, 21 ноября 2012 г.

$(window).resize() issue in IE 9

if ($.browser.msie) {
    function debouncer(func, timeout) {
        var timeoutID, timeout = timeout || 200;
        return function () {
            var scope = this,
                args = arguments;
            clearTimeout(timeoutID);
            timeoutID = setTimeout(function () {
                func.apply(scope, Array.prototype.slice.call(args));
            }, timeout);
        }
    }
    $(window).resize(debouncer(function (e) {
        myfn(); //your staff here
    }));
} 
 
got it from here 

понедельник, 12 ноября 2012 г.

change
  • color
  • <h1>TXJS 2011 Speakers</h1>
    <ul>
      <li><span>Brendan Eich</span></li>
      <li><span>Alex Russell</span></li>
      <li><span>Douglas Crockford</span></li>
      <li><span>Paul Irish</span></li>
    </ul>
    
    <style>
      ul {
        list-style: square outside;
        color: #ccc;
      }
      li > span {
        color: #000;
      }
    </style> 
     
    got from here: here 

    string to unicode

    public class TestTest {
        public static String convert(String str) {
            StringBuffer ostr = new StringBuffer();
    
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
    
                if ((ch >= 0x0020) && (ch <= 0x007e)) { // Does the char need to be converted to unicode?
                    ostr.append(ch); // No.
                } else { // Yes.
                    
                    ostr.append("\\u"); // standard unicode format.
                    String hex = Integer.toHexString(str.charAt(i) & 0xFFFF); // Get hex value of the char.
                    
                    for (int j = 0; j < 4 - hex.length(); j++)
                        // Prepend zeros because unicode requires 4 digits
                        ostr.append("0");
                    ostr.append(hex.toLowerCase()); // standard unicode format.
                    // ostr.append(hex.toLowerCase(Locale.ENGLISH));
                }
            }
    
            return (new String(ostr)); // Return the stringbuffer cast as a string.
        }
        public static void main(String[] args) {
            System.out.println(TestTest.convert("récupération de mot de passe"));
        }
    } 
     
    got this from here