wencaistorm / blog Goto Github PK
View Code? Open in Web Editor NEWToday I learned...
Home Page: http://wencaizhang.com/blog
Today I learned...
Home Page: http://wencaizhang.com/blog
// jQuery 之深拷贝
var temp = $.extend(true, [], resData);
// underscore 之深拷贝
_.extend(newArrr, oldArr);
// underscore 之浅拷贝,待验证 。。。
_.clone();
_.find(list, param)
_.findWhere(list, param)
返回第一个符合条件的_.filter(list, param)
_.where(list, param)
返回所有符合条件的那么问题来了,这四个函数,区别在哪???(黑人问号.jpg)
先挖个坑
正则验证工具: https://regexper.com/
$("input[type='radio']")
选择不同 type
的 input
$("input[type='radio']:checked")
选择被选中的 radio
选择父类元素
$selector.parent('td')
仅限于直接父类元素 parent
$(this).parents('.content')
只要是父类元素即可,能向父级多级查找 parents
选择子类元素
$ele.children('p.tip');
$this.siblings('.content').find('textarea')
选择兄弟元素 $selector.parent('td').siblings('.title')
在被选元素的结尾插入内容
$ele.append("<p class='tip red'> 请选择</p>");
在被选元素的开头插入内容
$(".must").prepend("<span class='red star'>* </span>");
在被选元素之前插入内容
$('.item:eq(2)').before($('.milestone'));
在被选元素之后插入内容
$('.item:eq(2)').after($('.milestone'));
remove()
删除被选元素(及其子元素),可传入参数(选择器)作为过滤条件
$tip.remove()
或$("p").remove(".italic");
empty()
删除被选元素的子元素
$tip.empty()
animate
动画使用固定值$dialog.animate({
top: "60px"
})
animate
动画使用相对值$dialog.animate({
top: "-=60px"
})
true
$(".box").is(":animated")
获取文本域的输入的内容
var $val = $this.siblings('.content').find('textarea').val();
获取属性值
var id = $(this).parents('.item').attr('id');
清空被选中的 radio
$("input[type='radio']").removeAttr('checked');
判断 radio
是否被选中
$(this).is(":checked")
判断元素是否具有指定的类名
$(this).hasClass("bad")
jQuery
对象有 length
属性,该属性表示选中的 DOM
元素的个数
if($radiosChecked.length != 2) {}
判断选中元素是否为 display:none
状态
if(!$(this).is(":hidden")) {}
序列化表单数据,用于 ajax
提交表单数据
$('form').serialize()
输入框失去焦点
$('input').blur(function () {});
- 环境:windows 系统
- 关键词:命令行工具
windows 系统的 cmd 是出了名的难用,这里不再吐槽,此处的重点是 cmder 的安装和使用
cmder
在实际的使用中,我们更多的需求是:在某个文件夹下打开终端。通过简单的设置,
cmder
就能如你所愿
cmder
存放的目录添加到系统环境变量。添加成功后,Win + r
后输入 cmder
回车即可打开 cmder
。Cmder.exe /REGISTER ALL
git bash
Cmder
有 mini 版和 full 版,区别在于 full 版有內建 msysgit 工具,即 Git for Windows所以,cmder
完全可以替代 git bash
做 git
相关的操作
cmd
cmder
都能做到。cmder
颜值更高,字体更好看,功能更强大,并且自带多套主题,随意替换。既然这样,还有什么理由不去使用呢?
可以使用下面命令连接 Linux 服务器
ssh -p 端口号 root@服务器IP
aliases
打开 Cmder 目录下的 config 文件夹,里面的 aliases 文件就是配置别名的文件
下面是一些实例:
gow=cd /d D:/www
gs=git status
sshdev=ssh -p 22 [email protected]
如果你同时还使用 AutoHotKey
,那真是再好不过了,为 cmder
配置快捷键(如:Alt + r
):
!r::run, D:\**\Cmder\Cmder.exe
配合 aliases
使用,简直有种天下任我行的快感!
Ctrl + v
直接粘贴Ctrl + 鼠标滑轮
轻易实现文字放大缩小Win+Alt+p
或者鼠标点击 cmder 左上角的图标选择 settings
,在 Settings -> Main -> Update
中,找到 Do automatic check on
后面的 startup
选项,取消勾选即可。// 取得查询字符串并去掉开头的问号
var qs = (location.search.length > 0 ? location.search.substring(1) : "");
var json = {};
qs.replace(/([^=&]+)=([^=&]*)/ig, function (a, b, c, d) {
json[b] = c;
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.