Skip to content

Instantly share code, notes, and snippets.

View webkong's full-sized avatar
🎯
Focusing

Denny webkong

🎯
Focusing
View GitHub Profile
@webkong
webkong / asyncSequentializer.js
Last active January 11, 2021 12:12
JavaScript工具函数
const asyncSequentializer = (() => {
const toPromise = (x) => {
if(x instanceof Promise) { // if promise just return it
return x;
}
if(typeof x === 'function') {
// if function is not async this will turn its result into a promise
// if it is async this will await for the result
return (async () => await x())();
@webkong
webkong / .stCommitMsg
Created January 11, 2021 08:52
Git commit message template with emoji.
# Title: Summary, imperative, start upper case, don't end with a period
# No more than 50 chars. #### 50 chars is here: #
:emoji: <Type> [Title info]
# Remember blank line between title and body.
# Body: Explain *what* and *why* (not *how*). Include task ID (Jira issue).
# Wrap at 72 chars. ################################## which is here: #
<Body>
# At the end: Include Co-authored-by for all contributors.
# Include at least one empty line before it. Format:
@webkong
webkong / ListTile.dart
Last active November 22, 2019 03:42
[Flutter widget] #Flutter
ListTile(
leading: Image.network(memorabiliaList[index].photo),
title: Text(
memorabiliaList[index].title,
style: const TextStyle(
fontWeight: FontWeight.bold,
),
),
subtitle: Text(
memorabiliaList[index].description,
@webkong
webkong / config 不压缩代码和自动去掉console.log
Last active November 22, 2019 03:54
[Vue.config.js]Vue配置相关 #Vue
// vue.config.js
module.exports = {
publicPath: "./",
productionSourceMap: false,
pages: {
client: {
entry: "src/client/main.js",
template: "public/index.html",
filename: "client.html",
title: "SHAREit",
@webkong
webkong / formatDate.js
Last active May 3, 2024 16:39
[JavaScript]snippets for JavaScript #JavaScript
/**
* @description 将时间转换成指定格式
* @param {String|Number} time
* @param {String} fmt
*/
export function timesToDate(time, fmt) {
fmt = fmt || 'yyyy-MM-dd';
time = anyTotime(time);
let date = new Date(time);
if (/(y+)/.test(fmt)) {