Skip to content

Instantly share code, notes, and snippets.

Avatar

楼教主 52cik

View GitHub Profile
@52cik
52cik / vue.config.js
Created Apr 10, 2020
vue config Component img src resolving - vue 自定义图片组件 src 解析配置
View vue.config.js
/** @type {import('@vue/cli-service').ProjectOptions} */
module.exports = {
chainWebpack(config) {
// https://bootstrap-vue.js.org/docs/reference/images/
// https://github.com/webpack-contrib/html-loader
config.module
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap((options) => {
@52cik
52cik / docker-batch-pull.sh
Last active Jul 2, 2021
docker 镜像批量更新
View docker-batch-pull.sh
for i in $( docker images --format "{{.Repository}}:{{.Tag}}" )
do
docker pull $i
done
# or
# docker images --format "{{.Repository}}:{{.Tag}}" | xargs -L1 docker pull
docker image prune -f
@52cik
52cik / getUserIP.js
Last active Sep 27, 2019
getUserIP (Promise)
View getUserIP.js
/**
* Get the user IP throught the webkitRTCPeerConnection
*
* @return {Promise<string>}
*
* @see Get the client IP address with Javascript on Safari {@link https://stackoverflow.com/questions/46925857/get-the-client-ip-address-with-javascript-on-safari}
*/
function getUserIP() {
//compatibility for firefox and chrome
var myPeerConnection =
@52cik
52cik / countDown.js
Created Jun 6, 2017
倒计时处理方法 (精确时间处理)
View countDown.js
/**
* 倒计时处理方法 (精确时间处理)
*
* @param {Number} seconds 剩余秒数/时间戳
* @param {Function} callback 回调函数
* @param {Boolean} timeStamp 是否时间戳
*
* 使用例子
*
* // 情况1:后台给的是倒计时 秒
@52cik
52cik / post-receive.sh
Created Jan 13, 2017 — forked from icyleaf/post-receive.sh
git autodeploy script when it matches the string "[deploy]"
View post-receive.sh
#!/bin/sh
#
# git autodeploy script when it matches the string "[deploy]"
#
# @author icyleaf <icyleaf.cn@gmail.com>
# @link http://icyleaf.com
# @version 0.1
#
# Usage:
# 1. put this into the post-receive hook file itself below
@52cik
52cik / wxbg.js
Created Dec 26, 2016
微信背景音乐自动播放
View wxbg.js
// <audio src="bg.mp3" id="media" autoplay loop preload="auto"></audio>
var player = document.getElementById('media');
player.play();
// iphone 下要监听 WeixinJSBridgeReady 事件
document.addEventListener('WeixinJSBridgeReady', function () {
player.play();
}, false);
@52cik
52cik / opener.js
Created Nov 11, 2016
修改连接跳转页面地址
View opener.js
var opener = parent.window.opener;
opener && (opener.location='http://www.baidu.com/');
@52cik
52cik / git.txt
Created Oct 9, 2016
git 强行回退
View git.txt
假设你有3个commit如下:
commit 3
commit 2
commit 1
其中最后一次提交commit 3是错误的,那么可以执行:
git reset --hard HEAD~1
你会发现,HEAD is now at commit 2。
@52cik
52cik / crockford-style.js
Created Sep 26, 2016 — forked from nolanlawson/crockford-style.js
Updated IIFE benchmark
View crockford-style.js
var s = performance.now();
/**
* Copyright (c) 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
(function () { 'use strict';var SLICE$0 = Array.prototype.slice;