ESLint - no-await-in-loop 疑惑
在使用eslint的时候,遇到async/await语法 会报错,总是提示 no-await-in-loop。举个例子看下面的代码的逻辑
for (let i = 0; i < userRedpacketItem.length; i += 1) { userRedpacketItem[i].product_id = await productModel.redpacketMapPrdIdToRe...
在使用eslint的时候,遇到async/await语法 会报错,总是提示 no-await-in-loop。举个例子看下面的代码的逻辑
for (let i = 0; i < userRedpacketItem.length; i += 1) { userRedpacketItem[i].product_id = await productModel.redpacketMapPrdIdToRe...
最近玩了下Yii2的验证码部分,正常的逻辑都可以走通的,网上的例子也是没有问题的,关键有问题的部分是在module中使用的时候,分享给大家,往下看之前可以去看看正常情况下是如何使用的。
controller部分的代码,这里的跟网上的都类似
public function actions() { return [ 'captcha' => [ 'class...
页面中总有一些操作是,需要图片加载完之后去做的,下面的代码可实现,需要的拿走
$("img").one("load", function(v) { // 逻辑处理 $(v.target).parent().parent().find('.over-shade').css({'height':$(v.target).height()}); }).each(function() { if(t...
laravel版本:5.2.*
php artisan make:listener QueryListener --event=Illuminate\\Database\\Events\\QueryExecuted
or
sudo /usr/local/bin/php artisan make:listener QueryListener --event=Illuminate\\Datab...
之前有写过类似的一篇文章,有位同学突然找来解惑,发现自己采用了另外的一个方法,这里也分享下,希望对使用reactjs的同学有帮助。
逻辑思路是这样子的,在componentDidMount中实现更新dom的操作,异步加载需要的资源文件,然后在加载完后实现qiniu的初始化操作。这里就不需要在webpack或者其他打包工具中去引入qiniu的包文件,导致打完包的文件过大了。
我这里使用了nodejs的库
...PHP7 的新特性大概浏览下,还是能在工作的效率上有很大益处的。
1,性能提升
这个我就不做测试了,哈哈
2,类型声明
class Student { public function __construct() { $this->name = 'durban'; } } $student = new Student(); function enroll(Stud...
举例子如下:
$models = static::where('user_id', $userId)->leftJoin('product_gift', function ($join) { $join->on('product_gift_exchange_order.prd_id', '=', 'product_gift.prd_id'); $join->on('product_g...
记录分享
{ "always_show_minimap_viewport": true, "bold_folder_labels": true, "color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme", "folder_exclude_patterns": [ "node_modules" ],...
配置分享,好像很难找到标准的
{ "psr2": true, "enable_auto_align": true, "php_bin":"/usr/local/opt/php71/bin/php", }
就这么简单。但是还有个保存自动格式化的,这个在默认的配置里面加就好了。
sublime text 3 配置分享
{ "always_show_minimap_viewport": true, "font_face":"Source Code Pro for Powerline", "font_size":14, "bold_folder_labels": true, "color_scheme": "Packages/Material Theme/scheme...
代码记录如下
Host github.com User git Hostname ssh.github.com Port 443 ProxyCommand connect -S 127.0.0.1:1180 %h %p Host bitbucket.org User git Hostname altssh.bitbucket.org Port...
需要使用github,但是国内访问很慢,往往会发生connection refused的事情发生,那就自己去弄个vpn吧。前提不要做扰乱国家安稳的事情
下面记录下git的配置方法
git config --global http.proxy 'socks5://127.0.0.1:1080' git config --global https.proxy 'socks5://127.0.0.1:108...
最近使用koa2做项目测试开发,想整合下travis ci,网上资料也比较少,于是自己就整了个,做个记录。
先来看下travis.yml的配置
language: node_js node_js: - "6" before_script: - ./node_modules/.bin/knex migrate:latest --knexfile='./app/knexfile.js' s...
node.js 从 4.4.0 版本开始内置了 profiler, --prof
命令选项运行应用会在当前目录生成性能日志文件。
简单记录下使用方法
运行的时候加上 --prof 参数
node app.js --prof
运行后会在当前目录生成一个类似:isolate-0x1d1e1b0-v8-10041.log这样的文件
执行如下命令来分析程序的性能
node --prof-process isolate...
npm install -g knex
然后在项目的根目录
knex init
将会产生knexfile.js,内容类似如下
// Update with your config settings. module.exports = { development: { client: 'mysql', connection: { host: '127.0....
新建个文件
app.js
里面的内容如下:
console.log(__dirname + '/example.db'); console.log('example.db');
如果将app.js放在一个根目录下面
执行node app.js
分别输出如下内容:
/Users/durban/nodejs/koa-mysql-orm-model/example.db example.db
我们建立一个文件夹app,
...最近push代码到github的时候出现了问题
...$ git push origin master
ssh: connect to host github.com port 22: Operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rig
如何在vim中搜索项目代码
这里使用的工具分别是Ag和Ack
Ag和Ack都是一个全局搜索工具,但是Ag会更快,比Ack和Grep都要快
通过网络搜索后:http://harttle.com/2015/12/21/vim-search.html
使用方式是用Ag来进行搜索,使用Ack用来展示结果。
现在来进行安装步骤总结
# OSX brew install the_silver_searcher #...
数据加密传输,这个目前我接触的几个方式,一个是密文传输,一个明文传输
密文传输,就是用密钥对数据加密,使用公钥对数据解密,传输的通道可以是https的也可以是http的。
明文传输,前提是建立一个安全的传输通道,这里使用证书对通道的安全做了防护,然后传输数据,使用的是明文。
比较专业的 可以后面慢慢分享,不过这里我就介绍下明文传输,如果是用nodejs建立安全通道
使用两个库,分别是urllib和requ
...