Skip to content

Instantly share code, notes, and snippets.

View AlfieriChou's full-sized avatar
🎧
Focusing

Alfieri AlfieriChou

🎧
Focusing
  • Hangzhou China
View GitHub Profile
@AlfieriChou
AlfieriChou / .git-commit-template.txt
Created May 15, 2019 02:30 — forked from adeekshith/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@AlfieriChou
AlfieriChou / get-npm-package-version
Created January 27, 2019 14:09 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@AlfieriChou
AlfieriChou / transaction.js
Last active January 16, 2021 02:53
sequelize.transaction.js
const transaction = async () => {
let trx = await sequelize.transaction()
try{
const user = await User.create({
first_name: 'wwang',
last_name: 'ahahaha'
}, {trx})
const updateResult = await User.update({
first_name: 'wang'
}, {
This file has been truncated, but you can view the full file.
/*!
* ReDoc - OpenAPI/Swagger-generated API Reference Documentation
* -------------------------------------------------------------
* Version: "1.22.0"
* Repo: https://github.com/Rebilly/ReDoc
*/
@AlfieriChou
AlfieriChou / archive.js
Created June 7, 2018 07:00
文件打包
const path = require('path');
const express = require('express')
const app = express()
const archiver = require('archiver')
app.get('/', function(req, res) {
const archive = archiver('zip');
@AlfieriChou
AlfieriChou / arrayFilters.js
Created February 26, 2018 02:04
mongoose arrayFilters
import mongoose from 'mongoose';
run().catch(error => console.error(error.stack));
async function run() {
await mongoose.connect('mongodb://localhost:27017/test');
await mongoose.connection.dropDatabase();
const BlogPost = mongoose.model('BlogPost', new mongoose.Schema({
import request from 'request-promise';
const geo = (req, res) => {
const latitude = req.body.latitude;
const longitude = req.body.longitude;
let options = {
method: 'POST',
uri: 'https://apis.map.qq.com/ws/geocoder/v1',