Skip to content

Instantly share code, notes, and snippets.

"linebreak-style": [0, "error", "windows"],
"no-restricted-syntax": 0, // Use Object.{keys,values,entries}, and iterate over the resulting array 爱尖子关掉这个。但期望还是开启。后期待定吧
"import/no-unresolved": 0, // 关闭import文件的后缀名校验,因为webpack配置的别名,es6可以找到对应的模块,爱尖子项目可以关闭这个
"comma-dangle": ["error", "never"], //是否允许对象中出现结尾逗号
"no-cond-assign": 2, //条件语句的条件中不允许出现赋值运算符
"no-console": 2, //不允许出现console语句
"no-constant-condition": 2, //条件语句的条件中不允许出现恒定不变的量
"no-control-regex": 2, //正则表达式中不允许出现控制字符
"no-debugger": 2, //不允许出现debugger语句
const Apify = require('apify');
const puppeteer = require('puppeteer');
const { typeCheck } = require('type-check');
const { log, dir } = console;
const INPUT_TYPE = `{
searchQuery: String
}`;
@cyio
cyio / .vimrc
Created June 5, 2018 07:20
史上最强的Vim 配置文件(原版+中文改进版) - CSDN博客 https://blog.csdn.net/BjarneCpp/article/details/77744513
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer: amix the lucky stiff
" http://amix.dk - amix@amix.dk
"
" Version: 3.6 - 25/08/10 14:40:30
"
" Blog_post: 发布的博客地址
" http://amix.dk/blog/post/19486#The-ultimate-vim-configuration-vimrc
" Syntax_highlighted: 带有语法高亮的html版本
@cyio
cyio / open-in-new-window-chrome-extension.js
Created May 15, 2018 08:09
open-in-new-window-chrome-extension.js
$('#JaxxLogo').on('click', function () {
openPopupInNewWin()
// -- open popup window -- start
var _bg_view = null ;
function getBackgroundView() {
if (!_bg_view) {
_bg_view = chrome.extension.getBackgroundPage();
if (!_bg_view) {
var views = chrome.extension.getViews({});
for (var i = 0, l = views.length; i < l; i++) {
@cyio
cyio / parse-date.js
Created April 12, 2018 09:21
parse date
const [all, year, month, day] = /([0-9]*)\-([0-9]*)\-([0-9]*)/.exec('2018-04-03')
console.log(all, year, month, day)
@cyio
cyio / parse-url.js
Last active April 12, 2018 03:37
parse url
// only work in browser environment
export const parseUrl = url => {
const a = document.createElement('a')
a.href = url
return {
href: a.href,
protocol: a.protocol,
host: a.host,
hostname: a.hostname,
@cyio
cyio / install-ripgrep-on-ubuntu.sh
Last active July 17, 2019 08:21
Install ripgrep on Debian / Ubuntu
#!/bin/bash
[[ $UID == 0 ]] || { echo "run as sudo to install"; exit 1; }
if ! [ -x "$(command -v jq)" ]; then
echo 'Error: jq is not installed.' >&2
apt install jq -y
fi
REPO="https://github.com/BurntSushi/ripgrep/releases/download/"
RG_LATEST=$(curl -sSL "https://api.github.com/repos/BurntSushi/ripgrep/releases/latest" | jq --raw-output .tag_name)
@cyio
cyio / for-in.vue
Created January 29, 2018 06:51
for in object vue
<template lang="pug">
table
tr(v-for="name in Object.keys(table)")
th(@click="table[name].expand = !table[name].expand") {{name}}
td(v-for="value in table[name].content" v-show="value < 3") {{value}}
td(v-for="value in table[name].content" v-show="table[name].expand")
span(v-show="value >=3") {{value}}
</template>
<script>
export default {
@cyio
cyio / max-btc.js
Last active January 6, 2018 22:57
总量不是固定数值,而是由衰减规则定义 Blockchain: What is Mining? - Damien Cosset https://www.damiencosset.com/blockchain-what-is-mining/
// First 210 000 blocks reward
const start_reward = 50
// The reward is modified every 210000 blocks
const reward_interval = 210000
const max_btc = () => {
// 50 BTC = 5000000000 Satoshis
// Satoshis are the smallest denomination in bitcoin
let current_reward = 50 * 10 ** 8
@cyio
cyio / commit.diff
Created December 6, 2017 03:20
fix vue-cli IP access
diff --git a/config/index.js b/config/index.js
index 08d4d4d..08e8228 100644
--- a/config/index.js
+++ b/config/index.js
@@ -13,7 +13,7 @@
proxyTable: {},
// Various Dev Server settings
- host: 'localhost', // can be overwritten by process.env.HOST
+ host: '0.0.0.0', // can be overwritten by process.env.HOST