IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    web培训

    notsobad发表于 2012-03-23 17:30:00
    love 0

    培训的简单提纲

    Bootstrap

    Grid

    网格,标准布局:940px,分为16个格, 用于实现多列布局

    layout

    布局

    Typography

    标题、列表、code、pre、label等元素的样式

    Tables

    各种表格样式

    Forms

    表单

    Navigation

    导航栏、tabs、面包屑导航、分页

    alert & errors

    告警、提示信息

    Popovers

    弹出层提示

    Tooltips

    对title的提示优化

    underscore

    借鉴了一些函数式变成的思想,_.each, _.map, _.reduce,

    增强了数组处理: _.first, _.last, .indexOf

    一个简单的模板引擎:

    _.template

    var list = "<% _.each(people, function(name) { %> 
  • <%= name %> <% }); %>"; _.template(list, {people : ['moe', 'curly', 'larry']}); => "
  • moe
  • curly
  • larry"

    jQuery

    Core

    Manipulation

    DOM操作

    .attr()
    .append()
    .before()
    .after()
    .clone()
    ...
    

    Selectors

    选择器

    $("tr:odd").css("background-color", "#bbbbff");
    
    $("td:eq(2)").css("color", "red");
    
    $("div:visible").click(function () {
          $(this).css("background", "yellow");
    });
    

    Travelsing

    元素相对查找

    $('li.third-item').next().css('background-color', 'red');
    
    $('li').has('ul').css('background-color', 'red');
    
    $('li.item-a').parents().css('background-color', 'red');
    
      $("div").one('click', function () {
        if ($(this).is(":first-child")) {
          $("p").text("It's the first div.");
        }
      )};
    

    Events

    事件处理

    .click()
    .mouseover()
    

    Ajax

    //get
    $.get('ajax/test.html', function(data) {
      $('.result').html(data);
      alert('Load was performed.');
    });
    
    //post
    $.post('ajax/test.html', function(data) {
      $('.result').html(data);
    });
    
    
    
    $.ajax({
      type: 'POST',
      url: url,
      data: data,
      success: success,
      dataType: dataType
    });
    

    Python

    pdb

    python -mpdb test.py,调试一个脚本,或者__import__('pdb').set_trace()

    a = 1
    b = 2
    
    def testfunc():
        a = 233
        print a
        __import__('pdb').set_trace()
    
    testfunc()
    
    wangxh@mac : ~/Desktop/ python test.py 
    233
    --Return--
    > /Users/wangxh/Desktop/test.py(8)testfunc()->None
    -> __import__('pdb').set_trace()
    (Pdb) l
      3     b = 2
      4     
      5     def testfunc():
      6         a = 233
      7         print a
      8  ->     __import__('pdb').set_trace()
      9     
     10     testfunc()
     11     
     12     
    [EOF]
    (Pdb) print a
    233
    (Pdb) print b
    2
    (Pdb) locals()
    {'a': 233, '__return__': None}
    (Pdb) vars()
    {'a': 233, '__return__': None}
    (Pdb) print b
    2
    (Pdb) globals()
    {'a': 1, 'b': 2, '__builtins__': <module '__builtin__' (built-in)>, '__file__': 'test.py', '__package__': None, '__name__': '__main__', '__doc__': None, 'testfunc': <function testfunc at 0x10f791938>}
    (Pdb) 
    

    profile

    cProfile

    python -m cProfile -o output_filename.pstats path/to/script arg1 arg2
    
       ncalls  tottime  percall  cumtime  percall filename:lineno(function)
            1    0.000    0.000    0.000    0.000 test.py:2(<module>)
          7/2    0.000    0.000    0.000    0.000 test.py:31(search)
            1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
    
    • ncalls 被调用次数
    • tottime 函数体运行总时间
    • percall 平均一次调用时间
    • cumtime 调用总时间含子函数
    • percall 平均调用时间含子函数
    • filename:lineno(function)


沪ICP备19023445号-2号
友情链接