Skip to content

Instantly share code, notes, and snippets.

View kingzez's full-sized avatar
🎯
Focusing

Vincent W kingzez

🎯
Focusing
View GitHub Profile
@kingzez
kingzez / setNodeMirror.sh
Created July 7, 2023 02:44 — forked from hetykai/setNodeMirror.sh
修改node npm yarn的镜像源设置,替换为国内的淘宝源
npm set registry https://registry.npm.taobao.org && \
npm set disturl https://npm.taobao.org/dist && \
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass && \
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ && \
npm set puppeteer_download_host https://storage.googleapis.com.cnpmjs.org && \
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver && \
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver && \
npm set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs && \
npm set selenium_cdnurl https://npm.taobao.org/mirrors/selenium && \
npm set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector && \
@kingzez
kingzez / analytics.js
Created July 14, 2020 08:50 — forked from zmmbreeze/analytics.js
GA的源码 analytics.js
(function() {
/**
* 记录方法使用情况的类
* @param {Array.<boolean>} umMap 初始的使用情况
*/
var UsageManager = function(umMap) {
this.umMap = umMap || [];
};
/**
* 记录新的使用情况
@kingzez
kingzez / bem.less
Created June 2, 2020 10:11 — forked from vivid-web/bem.less
BEM Helper (SCSS, SASS, LESS, Stylus)
// Mixins
.has(@element; @content) {
&__@{element} {
@content();
}
}
.variant(@modifier; @content) {
&--@{modifier} {
@content();
@kingzez
kingzez / curl.md
Created October 10, 2019 06:43 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@kingzez
kingzez / postgres-brew.md
Created July 23, 2019 15:39 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@kingzez
kingzez / IncrementId
Last active November 28, 2018 04:35 — forked from elrrrrrrr/IncrementId
mongoose实现id自增
var mongoose = require('mongoose');
var Sequence = require('./sequence');
var pieceSchema = mongoose.Schema({
id: { type : Number, index: { unique: true } },
content: String,
link: String,
pics:[String] ,
@kingzez
kingzez / arcanist.md
Created August 20, 2018 15:35 — forked from potench/arcanist.md
Install Phabricator on OSX and Install arcanist

OSX Arcanist Installation Guide

Note, please replace "WWW/tools" with where ever you store your web tools.

$ mkdir ~/WWW/tools
$ cd ~/WWW/tools
$ git clone https://github.com/phacility/libphutil.git
$ git clone https://github.com/phacility/arcanist.git
@kingzez
kingzez / sequelize transaction await
Created August 15, 2018 03:39 — forked from hoangbits/sequelize transaction await
using await with transaction in sequelize ORM
// get transaction
const transaction = await sequelize.transaction();
try {
// step 1
await Model.destroy({where: {id}}, {transaction});
// step 2
await Model.create({}, {transaction});
// commit
@kingzez
kingzez / nodejs_db_with_restapi.js
Created January 31, 2018 15:11 — forked from dalelane/nodejs_db_with_restapi.js
Node.js, Express, and SQLite to wrap a REST API around an SQL database
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('data/demodb02');
db.serialize(function() {
db.run("CREATE TABLE IF NOT EXISTS counts (key TEXT, value INTEGER)");
db.run("INSERT INTO counts (key, value) VALUES (?, ?)", "counter", 0);
});