-
mkdown语法概要
**这是加粗的文字**
*这是倾斜的文字*`
>这是引用的内容
---分隔线或***
![image]
-=* 一个空格表示无序列表
*111
*222
*333
1.数字加点有序列表
表格
表头|表头|表头
---|:--:|---:
内容|内容|内容
内容|内容|内容
'代码 '
'''多行代码
'''
-
js总结
padding 两个上下,三个上左右下,四个上右下左
.label>#label1>label selector css标签选择
attr(key,value) attr(key) #属性的读取
#datatype:"json"替代eval'('+arg+')',
//var total = node.children($("#size"));
for (var x in arg.parts){
arg.parts[x].part //json数组用[]访问,key用.号访问
}
//第一个字节点
node.find("li").first().addClass("active");
node.find("li :first-child")
查找是否存在字符串,x.indexOf("")>=0
.replace(/[^0-9]/ig, "")去掉非数字部分
嵌套ajax,由于异步特性,第二次的ajax数据会读取不出来,解决办法
#两次请求放在服务器端一起出来发送回来 方便
#而把第一次请求的结果存放在html里面,再次请求时候读取出来,逻辑复杂点
#同步ajax,网页容易卡住
#获取input $(" input[ name='test' ] ").val()
#focus样式在已经被设置样式了就无效了
#灵活运用删除属性 dialog.find("input[type='text']").css("border", "");
要是代码换行请用 /r/n
要是网页显示后排版换行请用 <br/>
也可以用标签ul li换行,实质是display: list-item
setTimeout(function(){cleardialog(div);}, 1000);//带参数的延时函数
#禁止重复弹框
function exist_dialog(){
var flag = false;
$(".dialog").each(function () {
if($(this).css('display')=='block'){
flag = true;
}
});
console.log(flag);
return flag
}
#mouseenter和mouseout配合使用的bug:
mouseenter到子元素的时候,触发了mouseout,清除了还未加载进来的异步操作的子元素,导致移入到子元素看不到
mouseover:当鼠标指针位于元素上方时,会发生 mouseover 事件。
mouseenter:当鼠标指针穿过元素时,会发生 mouseenter 事件。
mouseout:不论鼠标指针离开被选元素还是任何子元素,都会触发 mouseout 事件。
mouseleave:只有在鼠标指针离开被选元素时,才会触发 mouseleave 事件。
#jquery中获取元素的大小和位置信息
$(this).width()/height()
$(this).position().left()/top() //相对位置
$(this).innerWidth()/outerWidth()
$(this).offset().top/left //绝对位置
$(this).scrollLeft()/scrollTop //滚动位置
#cokie的存取
$.cookie("server_list", server_list);
var server_list = getCookie2('server_list')
if(server_list!=null){
$("#serverlist textarea").val(server_list);
}
#contentchanged文本内容变化
$(".container h3").bind("contentchanged", function () {
aleart('chagned')
})
$(".container h3").trigger('contentchanged');
-
css总结
-
django总结
1.正则的分组匹配,读取结果
uuid_find = re.search(uuid_patterns, line)
uuid = uuid_find.group('uuid')
uuid_find.group()
uuid_find.groups()
正则或者,forms.RegexField(r'(^[a-z]+)|(bcache[0-9]+)',min_length=3)
设置@method_decorator(ensure_csrf_cookie)保证服务器应答的cookie中一定带有csrftoken
//获取csrftoken
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
beforeSend: function (xhr, settings) {
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
},
#页面跳转为何cookie添加多次
#跨页面并保存原先页面的两个方式
1,变量放在cookie里面
2.变量放入session里面
3.参数放在url里面,新的url再带回来;这样写也可以解决href有动态参数的问题
<script language="JavaScript">
$(".cluster_url").on("click", function () {
window.location.href='{% url 'Cluster:Index' %}'+get_cur_server();
});
#对类函数进行装饰,并使用self的属性
def request_time(func):
def wrapper(self, *args, **kwargs):
start = time.time()
res = func(self, *args, **kwargs)
end = time.time()
print '{}() running time is: {}'.format(self.__class__.__name__, end - start)
print end - start
return res
return wrapper
#如果需要多个分割符,用re.split
str.strip() #默认\r,\n, \t,''都包含
-
git总结
#先建立远端库
git init
git status
git add * -v
git status
git commit -a 并输入说明
find . -name ".git" | xargs rm -Rf
git clone /opt/edu /opt/gitstore/edu
git config --bool core.bare true #远端修改,使能push
#从库上下载代码
git pull
git branch 看看分支
git chechout aaa 切换分支aaa
git branch aaa 创建aaa分支
git chechout -b aaa
#查看修改
git log
git diff HEAD~2 --q
-
shell命令
#find, while, awk
find /var/lib/ceph/osd -name journal | while read line ; do ls -lih $line ; done|awk -F "->" '{print $2}'