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/env python | |
# -*- coding:utf-8 -*- | |
""" | |
textdiff.py | |
Original is (C) Ian Bicking <[email protected]> | |
With changes from Richard Cyganiak <[email protected]> and Richard Cyganiak <[email protected]> | |
Modified from https://github.com/cygri/htmldiff/blob/master/htmldiff | |
Finds the differences between two pieces of TEXT. |
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
in HTML: | |
<textarea id="pubtextarea" placeholder="你在想什么?"></textarea> | |
in Javascript: | |
$(document).ready(function() { | |
var ie = document.all ? 1 : 0 | |
if(ie){ | |
$("#pubtextarea").val("你在想什么?"); | |
$("#pubtextarea").css("color","#A9A9A9"); | |
} |
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
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php | |
$('[placeholder]').focus(function() { | |
var input = $(this); | |
if (input.val() == input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(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
grep -nirl ‘xxx’ ./ | xargs grep -Hnir “yyy” | |
命令的前半截先列举出包含’xxx’关键字的文件路径和文件名。后半句在这些文件中搜索’yyy’关键字并列出。 |
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
curl -o ~/.vim/colors/molokai.vim http://www.vim.org/scripts/download_script.php?src_id=9750 | |
http://superuser.com/questions/301044/how-to-wget-a-file-with-correct-name-when-redirected |
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/env python | |
import sys | |
if __name__ == '__main__' and len(sys.argv) > 5 and sys.argv[1][-3:].upper() == 'PDF': | |
original = sys.argv[1] | |
target = original[:-4] + '.cropped.pdf' | |
left = int(sys.argv[2]) | |
top = int(sys.argv[3]) | |
right = int(sys.argv[4]) |
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
find . -type f -name "*.php" | xargs grep "DEF_BASE_LOG_PATH" | |
linux下查找某目录下所有文件包含某字符串的命令: | |
从文件内容查找匹配指定字符串的行: | |
$ grep "被查找的字符串" 文件名 | |
从文件内容查找与正则表达式匹配的行: | |
$ grep –e “正则表达式” 文件名 | |
查找时不区分大小写: | |
$ grep –i "被查找的字符串" 文件名 | |
查找匹配的行数: |
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
var Job = { | |
data : [ | |
"We are glad to see you here. This site is dedicated to", | |
"poetry and to the people who make poetry possible", | |
"poets and their readers. FamousPoetsAndPoems.com is", | |
"a free poetry site. On our site you can find a large", | |
"collection of poems and quotes from over 631 poets", | |
"Read and Enjoy Poetry", | |
"I, too, sing America", |
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
Being Processed Before: | |
http://goo.gl/JfLwg | |
1. update T_Image set isFetched=1 where url<>'' | |
2. update T_Image set isFetched=1 where dir<>'' | |
Being Processed After: | |
http://goo.gl/ooxfj |
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
对于item_detail: | |
先用 | |
alter table item_detail drop primary key; | |
删除原来的主键; | |
然后用: | |
alter table item_detail add column id int unsigned not null auto_increment primary key; | |
增加自增的主键id |