随笔分类 - JavaScript
关于JavaScript的东东
摘要:```javascript this.$clone = $clone = $(''); $clone.one('load', $.proxy(function () { var naturalWidth = $clone.prop('naturalWidth') || $clo...
阅读全文
摘要:```javascriptvar page = require('webpage').create();page.open('http://qq.com', function () { page.render('example.png'); phantom.exit();});```摘自...
阅读全文
摘要:```javascript@echo off:: 当前目录 src/testset currDir=src/test/set sourceMapFileName=test.js.mapset inputList=%inputList% --js test1.jsset inputList=%inpu...
阅读全文
摘要:```javascript//// Unpacker for Dean Edward's p.a.c.k.e.r, a part of javascript beautifier// written by Einar Lielmanis //// Coincidentally, it can def...
阅读全文
摘要:```javascriptnew Date('2014/04/30')Wed Apr 30 2014 00:00:00 GMT+0800 (中国标准时间)new Date('2014-04-30');Wed Apr 30 2014 08:00:00 GMT+0800 (中国标准时间)//第一个是地方...
阅读全文
摘要:```javascript$('#js-start-time').datepicker({ dateFormat:'yy-mm-dd', onSelect: function( startDate ) { var $startDate = $( "#js-start-time" ); var $endDate = $('#js-end-time'); var endDate = $endDate.datepicker( 'getDate' ); if(endDate < startDate){ $endD
阅读全文
摘要:就一句话,记录一下 urlreplace baidu.com taobao.com````javascript //Fiddler2\Scripts\SampleRules.js 这里发现的 case "urlreplace": if (sParams.Length<3) {gs_ReplaceToken=null; FiddlerObject.StatusText="URL Replacement cleared"; return;} gs_ReplaceToken = sParams[1]; gs_ReplaceTokenWith...
阅读全文
摘要:**minify.bat** @echo off if ""%1""=="""" goto end :loop if not exist %~dp1\min ( md %~dp1\min ) if ""%1""=="""" goto ok ::set inputlist=--js %~dpnx1 set inputlist=%~dpnx1 set outputfilename=%~n1.min.js set outputmapfilen
阅读全文
摘要:任务:从mongodb中导出csv数据,输出内容如下userid username usergender pointspoints表:{ "userid" : 1022, "points" : 12 }{ "userid" : 2592, "points" : 4 }{ "userid" : 7304, "points" : 44 }{ "userid" : 7343, "points" : 40 }{ "userid&quo
阅读全文
摘要://key:value|key:valuevar windowStorage = { _inited: false, _data: {}, init: function(str) { var tmpData, key, value, kv; this._inited = true; if (str && typeof str == 'string') { tmpData = str.split('|'); for (var i = 0, len = tmpData.length; i < l...
阅读全文
摘要:console.group('分组1');console.table( [ {key1: 1,key2: 2,key3: 3}, {key1: 1,key2: 2,key3: 3}, {key1: 1,key2: 2,key3: 3} ], ['key1', 'key2'] /*可选:要显示的key,其它忽略*/);console.groupEnd('分组1');//-------------------------console.groupCollapsed('分组2'); /*默认关闭的分组*/console.
阅读全文
摘要:打开调试器,切换到timer,点击左下角的record按钮开始,切换到memory视图,在文档中点击鼠标左右键,看股价走势图function Allocate(kbs){ this.mem = new Array(kbs * 1024 + 1).join(' '); this.destroy = function(){ this.mem = null; }}var located = [];window.onload = function(){ document.body.oncontextmenu = function(){ if(!loc...
阅读全文
摘要:对于“JavaScript 函数参数是传值(byVal)还是传址(byRef)”这个问题,普遍存在一个误区:number,string等“简单类型”是传值,Number, String, Object, Array等“复杂类型”是传址。
这样不对吗?为什么会有这样的误区?
阅读全文
摘要:在用jQuery.upload的时候遇到一个跨域的错误提示,似乎是top中设置了document.domain="abc.com",而iframe中没有这样的设置(iframe也是abc.com)导致无法读取innerHTML。最后换成由服务端返回script片段解决<script>document.domain = "abc.com";top.callback( /* response data */);</script>
阅读全文
摘要:每次运行到断点下一行,$fileBtn就不见了。。。最后才发现,是右边的监视变量改变了$fileBtn。---都说了是“监视变量”,活该在监视变量中写了修改的代码 @_@---以后得注意了
阅读全文
摘要:Useful chainable methods of cursor. These can optionally be options offindinstead of method calls:.limit(n).skip(m)to control paging..sort(fields)Order by the given fields. There are several equivalent syntaxes:.sort({field1: -1, field2: 1})descending by field1, then ascending by field2..sort([['
阅读全文
摘要:选择一对不同的、足够大的素数p,q。计算n=pq。计算f(n)=(p-1)(q-1),同时对p, q严加保密,不让任何人知道。找一个与f(n)互质的数e,且1<e<f(n)。计算d,使得de≡1 mod f(n)。这个公式也可以表达为d ≡ e-1 mod f(n)这里要解释一下,≡是数论中表示同余的符号。公式中,≡符号的左边必须和符号右边同余,也就是两边模运算结果相同。显而易见,不管f(n)取什么值,符号右边1 mod f(n)的结果都等于1;符号的左边d与e的乘积做模运算后的结果也必须等于1。这就需要计算出d的值,让这个同余等式能够成立。公钥KU=(e,n),私钥KR=(d,n
阅读全文
摘要:function ooaoao($dom, target, e) { var left = $(target).offset().left, top = $(target).offset().top, domHeight = this.boxHeight + e.clientY, domWidth = this.boxWidth + e.clientX + $(target).parent().width(), screenH = $(window).height() - $('#global_header').height(), screenW = $(window).wid
阅读全文
摘要:var memcache = require('memcache') , http = require('http') , url = require('url') , qs = require('querystring') , memsettings = { port: 2000, host: '10.6.0.6' } , httpsettings = { port: 3000 } , cacheObject = {} , httpserver , client , requestHandler;client =
阅读全文
摘要:var arr = [ {id:1}, {id:2}, {id:1}];/*unique(arr, 'id'); //->[{id: 1}, {id: 2}];unique([1,2,2,2,3,3,4]); //->[1,2,3,4];unique(arr, function(item){ return item.id;}); //->[{id: 1}, {id: 2}];*/function unique(array, filter){ var tmpObject = {hasStored: {}, uniqueArray: []}, i, fun; if
阅读全文

浙公网安备 33010602011771号