JavaScript
葡萄老君
这个作者很懒,什么都没留下…
展开
-
酷壳上的一段js代码分析
from Cool Shell I saw" 一段js代码", a confused code snipped, originates from here blackhat .原创 2011-02-01 17:02:00 · 539 阅读 · 0 评论 -
有关javascript中的this
javascript中函数中的this的值取决于使用哪个对象调用这个函数;function invocation in js is merely sending message between objects.函数的调用者提供身份,而函数本身的实现提供在这个身份下的行为。原创 2011-03-02 16:56:00 · 732 阅读 · 0 评论 -
new范式·2个例子
一段代码:var controller = { notify: function(obj){ obj.notify(); }}var base_obj = { notify: function(){ alert('base'); }}funct原创 2011-08-15 19:43:46 · 375 阅读 · 0 评论 -
Function Template和css utility function
Function Template和css utility function原理继承让对象具有另一个对象的api,自动具有某些方法的行为。那么能否让一函数具有另一个函数的部分行为,并且让它以另一个函数的行为为模板而扩展?其实在java,C++中通过拆分组合多个方法也可以实现这一目的,但js的'元类继承' (我不知道是谁提出的概念,我是从winter的博客上最初看到的)的概念使之实现上面原创 2011-10-24 15:28:42 · 982 阅读 · 1 评论 -
EventFront队列机制修改
先贴代码,这一段是小东的版本;现在我做了一些修改;function EventDispatcher(){ var that = this; this.dispatch = function(request) { if (typeof request.action == 'function') return request.action(); var controllerN原创 2011-11-14 20:58:54 · 380 阅读 · 0 评论 -
Sample of turning recursive function into non-recursive
This is sample of turning one recursive function into its non-recursive form, note this is a matter of traversal of binary-tree in post-order. Interestingly you will find in javascript, the recursiv原创 2013-05-27 00:04:17 · 605 阅读 · 0 评论 -
Find Nth Biggest Number Based On QuickSort
First, the recursive version of Quick sort algorithm: function partition(arr, low, high){ var pivot = arr[low]; while (low < high){ while (low < high) { if (arr[high] <= pivot ){原创 2013-05-26 23:33:23 · 574 阅读 · 0 评论 -
Build the seajs project 2: editing the Gruntfile
purposemy aim is these:i.when deploying a project, the js file's dependency can be dynamically and automatically managed, if this is not archived perfectly,at least there 's some shortcut to go;原创 2013-06-04 23:41:12 · 724 阅读 · 0 评论 -
Closure, Memory Leak and Memory Diagnose
what is Closure从概念上讲, Closure是一种语言机制,它的出现是为了满足函数式编程(functional programming lauguage)的某种设计需求, 即,为在函数式语言中作为first-class的函数对象提供与之绑定的数据环境注维基百科上说Closure是"a function or reference to a function together w原创 2013-06-20 04:57:48 · 1619 阅读 · 1 评论