index
程序员N定律和N原则---康威定律在实践中的一点思考
如何搭建自己的gitlab服务 Vim查找替换及正则表达式的使用
解压到指定文件夹 tar -zxvf foo.tgz ./boo tar -zxvf foo.tgz -C /opt/ unzip -d /opt foo.zip select B* from system_menu as A inner join system_menu as B on B.`parent_id`= A.id where A.id=9
Laravel:
shift() pop()
prepend() push()
from_unixtime();
unix_timestamp();
:Leaderf rg -e
查看外网地址
curl icanhazip.com
https://ipw.cn
https://ipaddress.my
https://iplocation.net
PRIMARY KEY (`id`),
KEY `t_u_s_index` (`topic_id`,`user_id`,`status`)
{!! !!} 相当于 <?php echo $value; ?>
{{ }} 相当于 <?php echo htmlspecialchars($value); ?>
laravel6移除了php artisan make:auth命令,
需要的时候执行composer require laravel/ui 下载扩展,
再执行php artisan ui vue --auth,
这里的vue可以换成 react或者bootstrap,决定使用的前端js框架。
$data = User::distinct()->offset(10)->limit(10)->get()->toArray();
查看版本
git log
git log -5
git log -5 filename
git log --oneline
查看版本更改详情
git show
git show {commit id}
回滚版本
git reset --hard HEAD^
git reset --hard HEAD^2
git reset --hard XXX
laravel5.6 频率限制throttle中间件,指定时间用户对路由的访问次数限制 yum -y update:升级所有包同时4102也升级软件和系统1653内核; yum -y upgrade:只升级所有包,不升级软件和系统内核。 insert model, ctrl+r=, 计算 windows查看进程: netstat -nato | finestr '443' tasklist | findstr 6108 set_error_handler set_exception_handler
2020-05-28
php debug输出问题 test中的测试方法 重新编译autoload.php文件 composer dump-autoload PHP 7 标量类型声明 RFC,也可是 declare(strict_types = 1) 该RFC建议添加4种新的标量类型声明:int,float,string和bool, 这些类型声明将会和PHP原来的机制保持一致的用法。 RFC更推荐给每一个PHP文件,添加一句新的可选指令(declare(strict_type=1);), 让同一个PHP文件内的全部函数调用和语句返回,都有一个“严格约束”的标量类型声明检查。
2020-05-20
linux IP转发永久生效 vim /etc/sysctl.conf >> net.ipv4.ip_forward = 1 sysctl -p /etc/sysctl.conf systemctl restart network leaderF ctrl+F -- fullpath to filename; 综合查找方式: filename;pathname ctrl+R -- to regex 批量删除buffers :3,5bd :bd 3 4 5 :bd *.vue <c-a> --clear *.vue file buffer :%bd --clear all buffers
2020-05-15
批量替换diary路径
args **/*.html
set nomore
argdo %s/diary\/diary\.html/diary\//ge | update
R:则是不停的替换(一个挨着一个)
K → 帮助
'' 找到某个单词后, 再输入此命令则回到上次停留的位置.
`` 恢复
:abbr sprt System.out.println
输入sprt加非字母,显示System.out.println
/vim\|files 同时查找两个词
/jo[ha]n Search john or joan
/\<the Search the, theatre or then
/the\> Search the or breathe
/\<the\> Search the
/\CApp 只匹配App
/\cApp 匹配App app
/[\u4e00-\u9fa5]\+ 匹配中文
/[\u4e00-\u9fa50-9A-Za-z]\+ 匹配中文
/[\u4e00-\u9fa5_0-9A-Za-z]\+ 下斜杠
%s/^\(\S\+ *\)\(\S\+ *\)/\2\1/g 交换空格隔开的两列
\S -- 非空格
* -- 0到多{0,}
\+ -- 1到多{1,}
\? -- 0-1{0,1}
magic: 除了`^.*$`之外所有的字符都需要加反斜杠
##$subpattern = '/([\x{4e00}-\x{9fa5}_a-zA-Z0-9\s。?!,、;:“”’‘()【】《》]{0,6}?)';
\sE topX
\st 光标下的table名
\sT 光标下的table名,并设置前多少行
\sdt desc tablename
\slt show tables;
\slv show views
增加图片链接
[[http://www.hkcd.com/images/a.jpg|{{http://localhost/image/aa.jpg}}]]
/pattern ?pattern 反向匹配
:%s/ */ /g 将多个空格换成一个空格
:g/^$/d 删除所有空行
:g/^ *$/d 删除所有的空白行和空行
:%s/\([:.]\) */\1 /g 使用空格替换句号或者冒号后面的多个空格
“abc……xyz”替换为“xyz……abc”
:%s/abc\(.*\)xyz/xyz\1abc/g
:%s/\(abc\)\(.*\)\(xyz\)/\3\2\1/g
远程编辑文件(使用操作系统的ftp)
:e ftp://192.168.10.76/abc.txt
:w ftp://192.168.10.76/abc.txt
:r ftp://192.168.10.76/abc.txt
vim ftp://username@hostname[:port]/full_directory/filename
$vim scp://user@host/[path_to_file] ???
Ctrl+a Increment number under the cursor
Ctrl+x Decrement number under the cursor
$array = array(
0 => '霜天部落',
1 => false,
2 => 1,
3 => null,
4 => '',
5 => 'http://www.hzhuti.com',
6 => '0'
);
print_r(array_filter($array));
/*
输出结果为:
Array
(
[0] => 霜天部落
[2] => 1
[5] => http://www.hzhuti.com
)
*/
2020-05-09
当使用 rem 单位,他们转化为像素大小取决于页根元素的字体大小,即 html 元素的字体大小。
html{font-size:16px; padding:10rem;}
当使用em单位时,像素值将是em值乘以使用em单位的当前元素的字体大小。
.container {font-size:16px; padding-top:10em;}
不要在多列布局中使用 em 或 rem ,改用%。
设计组件比如按钮,菜单。 当你修改字体大小的时候,你希望整个组件都适当缩放。
使用em单位,默认字体大小的元素上的padding、 margin、 width、 height和line-height等值。
font-family: -apple-system-font,"Microsoft YaHei","微软雅黑","黑体",Arial;
-apple-system-font 默认苹果字体
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
text-size-adjust 设置移动端随设备大小的字体
font: 12px/1.5 Arial line-height=12*1.5=18px
letter-spacing: .034em 字间距
color: #333 设置非纯黑字体
font-weight: 400 字体加粗,非blod
* { } 通配符,指所有html标签
[hidden] { display:none; }
button[disabled] { }
input[type="text"] { }
[src][target] { }
div#video {}
div.title {}
.title:before { }
[class^='span'] <div class="span1" />
[class$='item'] <div class="firstitem" />
[class*='span'] <div class="colspan1" />
[class|='col'] <div class="col-1" />
[class~="glyphicon"] <div class="glyphicon glyphicon-plus" />
2020-05-08
console.log('1','2','3');
console.log('%d + %d = %d', 1,1,2);
输出object对象
console.log('%o', document.body);
>>><body class style></body>
console.log('%O', document.body);
>>>输出详细节点
测试性能
console.time('lazy');var x=0;for(var i=0; i < 10000; i++) {x = x + i*i;} console.timeEnd('lazy');
输出DOM结构
console.dir(dom)
打印调用栈
console.trace()
console.error()
统计执行次数
console.count('xxx');
分组
console.group('group A');
console.log(1);
console.log('abc');
console.groupEnd('group A');
清空console
console.clear()
2020-04-28
模拟网页提交POST
curl -d "param1=value1¶m2=value2" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:3000/data
git pull #远程下载并合并分支
ps aux
ps -ef
ps -u www
netstat -nat | awk '{print $6}' | sort | uniq -c | sort -nr
netstat -l
netstat -p
netstat -r
netstat -n | awk '/^tcp/ {++S[$NF]} END {for (a in S) print a, S[a]}'
2020-04-25
ignore_user_abort(true);
set_time_limit(0)
error_reporting(E_ALL);
ini_set('display_errors', 1);
保存buffer列表
:let buffers = filter(range(1, bufnr('$')), 'bufexists(v:val)'
:let buffers = map(copy(getbufinfo()), 'v:val.bufnr')
:set sessionoptions=buffers
:mksession
:so Session.vim, or from the commandline with vim -S Session.vim
sessionoptions选项:
blank //空窗口
buffers //所有的缓冲区
curdir //当前目录
folds //折叠(fold)相关的信息
help //帮助窗口
options //所有的选项和映射
tabpages //所有的标签页
winsize" //窗口大小
slash //windows路径改为'/'
unix //linux换行
session设置:
:set sessionoptions=buffers,sesdir,folds,options,slash
:mksession .vimses //保存session
:source .vimses //恢复session
自动打开session
vim -S .vimses
:wviminfo //保存.viminfo
:rviminfo
:ls buffer列表
:ba a.txt 增加buffer
:bd a.txt 删除buffer
:3,5bd 删除3,4,5buffer
\wd 删除wiki文件
\wr 重命名文件,自动修改相关链接
\whh -- convert current wiki page to HTML and open it in webbrowser.
\w\w -- open/new today's diary
\w\i -- update diary section in diary index
\w\t -- open/new today's diary in a new tab
跳转到函数、全局结构、全局变量等tag: 组合键 ctrl_]
从tag处返回跳转的位置:组合键 ctrl_t
跳转到全局变量处: 快捷键 gD
跳转到局部变量处: 快捷键 gd
ctrl+w] 切换在当前窗口
:ts <tag> <RET> Search for a particular tag
:tn Go to the next definition for the last tag
:tp Go to the previous definition for the last tag
:ts List all of the definitions of the last tag
\\f
\\b
<f5> 更新目录缓存。
<c-f> / <c-b> 在模式之间切换
<c-d> 在”完整路径匹配“ 和 ”文件名匹配“ 之间切换
<c-r> 在“字符串模式” 和 “正则表达式模式” 之间切换
:1,10 w!a.txt 将1-10行写到文件a.txt
:res+5 resize window height
:vert res+5 resize window width
zz zt zb
光标移动到屏幕的上下或中部:H L M
m[a-z]
m[A-Z] 全局标签
'{a-zA-Z} 跳转到书签
:delm {marks} 删除一个书签:delm a
:delm ! 删除全部书签 (delete all marks)
:marks 显示系统全部书签
vis 选中一个句子
vib 选中一个block
viw 选中一个单词
vip 选中一个段落
) :光标移至句尾
( :光标移至句首
{:光标移至段落开头
}:光标移至段落结尾
:g/string/d
:v/string/d
vimgrep /pattern/ % 在当前打开文件中查找
vimgrep /pattern/ * 在当前目录下查找所有
vimgrep /pattern/ ** 在当前目录及子目录下查找所有
vimgrep /pattern/ *.c 查找当前目录下所有.c文件
vimgrep /pattern/ **/* 只查找子目录
:args 命令,vim 启动后还可以增删改
args \a\*.txt a目录下的所有纯文本文件作上标记,
args \a\**\*.txt 包括子目录
:argdo %s/\<x_cnt\>/x_counter/ge | update
:bufdo 是在所有 buffer 中执行命令