hyj1412's Blog

record, write and share.


  • Home

  • Tags

  • Categories

  • Archives

reg_express

Posted on 2015-07-07 | Edited on 2019-04-09 | In php

一些常用的正则表达式

1、身份证号

1
/(^\d{15}$)|(^\d{17}([0-9]|X)$)/

2、固定电话

1
/^0\d{2,3}-\d{7,8}$/

3、QQ号

1
/^\d{5,10}$/

4、手机号

1
/^(13[0-9]|147|15[0-9]|17[0-9]|18[0-9])\d{8}$/

5、URL

1
/^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"])*$/

或者

1
/^[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"])*$/

6、IP地址

1
/((?:(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d?\d))/

7、域名

1
/^([\w-]+\.)+((com)|(net)|(org)|(gov\.cn)|(info)|(cc)|(com\.cn)|(net\.cn)|(org\.cn)|(name)|(biz)|(tv)|(cn)|(mobi)|(name)|(sh)|(ac)|(io)|(tw)|(com\.tw)|(hk)|(com\.hk)|(ws)|(travel)|(us)|(tm)|(la)|(me\.uk)|(org\.uk)|(ltd\.uk)|(plc\.uk)|(in)|(eu)|(it)|(jp)|(co)|(me)|(mx)|(ca)|(ag)|(com\.co)|(net\.co)|(nom\.co)|(com\.ag)|(net\.ag)|(fr)|(org\.ag)|(am)|(asia)|(at)|(be)|(bz)|(com\.bz)|(net\.bz)|(net\.br)|(com\.br)|(de)|(es)|(com\.es)|(nom\.es)|(org\.es)|(fm)|(gs)|(co\.in)|(firm\.in)|(gen\.in)|(ind\.in)|(net\.in)|(org\.in)|(jobs)|(ms)|(com\.mx)|(nl)|(nu)|(co\.nz)|(net\.nz)|(org\.nz)|(tc)|(tk)|(org\.tw)|(idv\.tw)|(co\.uk)|(vg)|(ad)|(ae)|(af)|(ai)|(al)|(an)|(ao)|(aq)|(ar)|(as)|(au)|(aw)|(az)|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-04-09 | In git

Created by http://www.gitignore.io

Drupal

ignore configuration files that may contain sensitive information.

1
sites/*/*settings*.php

ignore paths that contain generated content.

1
2
3
files/
sites/*/files
sites/*/private

Ignore default text files

1
2
3
4
5
6
7
8
9
10
11
robots.txt
/CHANGELOG.txt
/COPYRIGHT.txt
/INSTALL*.txt
/LICENSE.txt
/MAINTAINERS.txt
/UPGRADE.txt
/README.txt
sites/all/README.txt
sites/all/modules/README.txt
sites/all/themes/README.txt

Ignore everything but the “sites” folder ( for non core developer )

1
2
3
4
5
6
7
8
9
10
11
12
13
14
.htaccess
web.config
authorize.php
cron.php
index.php
install.php
update.php
xmlrpc.php
/includes
/misc
/modules
/profiles
/scripts
/themes

some tmp file

1
2
3
4
5
6
7
8
*~
*.*~
*.lock
*.DS_Store
*.swp
*.out
*.swo
**git config --global core.excludesfile ~/.gitignore**

常用git命令

Posted on 2014-08-14 | Edited on 2019-04-09 | In git

先来张大图

git大图

每天都使用git,但是好记性不如烂笔头,写下来,以后忘了可以翻出来看看。

OK,言归正传!

下面是几个专有名词:

  • Workspace:工作区
  • Index / Stage:暂存区
  • Repository:仓库区(或本地仓库)
  • Remote:远程仓库

一、新建代码库

1
2
3
4
5
6
7
8
# 在当前目录新建一个Git代码库
git init

# 新建一个目录,将其初始化为Git代码库
git init [project-name]

# 下载一个项目和它的整个代码历史
git clone [url]

二、配置

Git的设置文件为.gitconfig,它可以在用户主目录下(全局配置),也可以在项目目录下(项目配置)。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 显示当前的Git配置
git config --list

# 编辑Git配置文件
git config -e [--global]

# 设置提交代码时的用户信息
git config --global user.name ""Your name""
git config --global user.email "Your email address"

# 快捷方式的设置
git config --global alias.st status
git config --global alias.ci commit
git config --global alias.df diff
git config --global alias.co checkout
git config --global alias.br branch
Read more »

iframe upload

Posted on 2014-08-14 | Edited on 2019-04-09 | In php , web

html:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<form method='POST' enctype='multipart/form-data' target='upload_iframe' class='common-note-form new_note' accept-charset="UTF-8" action='http://localhost/boss/profile/issue/js/upload_file";'>
<textarea id='comment' name='comment' class='note_text form-control' rows='5'></textarea>
<div class="note-form-actions">
<div class="buttons">
<input type="hidden" value="15" name='issue_id'>
<input id='submitcom' class='btn btn-primary comment-btn btn-grouped js-comment-button' type='submit' value='发表评论'>
</div>
<div class="note-form-option pull-left">
<a class="choose-btn btn js-choose-note-attachment-button btn-default">

<span>选择文件...</span>
</a>
&nbsp;<span class="file_name js-attachment-filename">文件名</span>
<input class="js-note-attachment-input hidden" id="note_attachment" name="files[note]" type="file">
</div>
</div>
</form>
<iframe name='upload_iframe' class='hide'></iframe>

####js:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// 点击上传文件按钮,触发input file空间
$('.choose-btn').on('click', function() {
var target;
return target = $(this).closest('form'),
target.find('.js-note-attachment-input').click();
});
// file空间变化事件
$('.js-note-attachment-input').on('change', function() {
var ele = $(this).closest('form');
var file_name = $(this).val().replace(/^.*[\\\/]/, "");
ele.find('.js-attachment-filename').text(file_name);
return false;
});
//发表评论
$('#submitcom').on('click', function() {
$(this).closest('form').submit();
var comment = $('#comment').val();
if(!comment.length) {
$.show_message('评论内容不能为空!');
return false;
} else {
$(this).closet('form').submit();
}
return false;
});

fedora yum 源

Posted on 2014-08-14 | Edited on 2019-04-09 | In linux

加载RPMForge源 http://pkgs.repoforge.org/rpmforge-release/

1
rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

remi http://mirrors.hustunique.com/remi/

1…891011

hyj1412

记录生活,书写心得,分享成果
51 posts
26 categories
48 tags
Creative Commons
© 2022 hyj1412 |
Creative Commons
Powered by Hexo v3.9.0
|
Theme – NexT.Muse v7.1.0