<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>路由分别加载controller测试</title>
<script src="bower_components/angular/angular.js" type="text/javascript" charset="utf-8"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.js" type="text/javascript" charset="utf-8"></script>
<script src="bower_components/oclazyload/dist/ocLazyLoad.js" type="text/javascript" charset="utf-8"></script>
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
#!/usr/bin/expect | |
set timeout 30 | |
spawn ssh [lindex $argv 0]@[lindex $argv 1] | |
expect { | |
"(yes/no)?" | |
{send "yes\n";exp_continue} | |
"password:" | |
{send "[lindex $argv 2]\n"} | |
} |
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
#!/usr/bin/expect #Where the script should be run from. | |
#If it all goes pear shaped the script will timeout after 20 seconds. | |
set timeout 20 | |
#First argument is assigned to the variable name | |
set name [lindex $argv 0] | |
#Second argument is assigned to the variable user | |
set user [lindex $argv 1] | |
#Third argument is assigned to the variable password | |
set password [lindex $argv 2] |
JavaScript权威指南 P59 中关于作用域链解释的不是很清楚。
JavaScript代码在执行的过程中,需要依赖其执行上下文(Execution Context), 当JavaScript代码被浏览器载入后,默认最先进入一个全局执行上下文,当在全局上下文中调用执行一个函数时,程序流就进入该被调用函数内,此时引擎就会为该函数创建一个新的执行上下文,并且将其压入到执行上下文堆栈的顶部。浏览器总是执行当前在堆栈顶部的上下文,一旦执行完毕,该上下文就会从堆栈顶部被弹出,然后,进入其下的上下文执行代码。这样,堆栈中的上下文就会被依次执行并且弹出堆栈,直到回到全局的上下文。
关于执行上下文(Execution Context) 可以将执行上下文,理解成为一个Object。它主要包含三个属性 变量对象,this 指向 和作用域链。
变量对象包括 函数的形参,函数声明和变量声明
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
//usage | |
withAdvice.call(targetObject); | |
//mixin augments target object with around, before and after methods | |
//method is the base method, advice is the augmenting function | |
withAdvice: function() { | |
['before', 'after', 'around'].forEach(function(m) { | |
this[m] = function(method, advice) { | |
if (typeof this[method] == 'function') { | |
return this[method] = fn[m](this[method], advice); |