Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View 52cik's full-sized avatar

楼教主 52cik

View GitHub Profile
@52cik
52cik / vue.config.js
Created April 10, 2020 14:10
vue config Component img src resolving - vue 自定义图片组件 src 解析配置
/** @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 October 6, 2023 12:39
docker 镜像批量更新
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 September 27, 2019 15:17
getUserIP (Promise)
/**
* 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 June 6, 2017 06:29
倒计时处理方法 (精确时间处理)
/**
* 倒计时处理方法 (精确时间处理)
*
* @param {Number} seconds 剩余秒数/时间戳
* @param {Function} callback 回调函数
* @param {Boolean} timeStamp 是否时间戳
*
* 使用例子
*
* // 情况1:后台给的是倒计时 秒
@52cik
52cik / post-receive.sh
Created January 13, 2017 06:39 — forked from icyleaf/post-receive.sh
git autodeploy script when it matches the string "[deploy]"
#!/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 December 26, 2016 05:51
微信背景音乐自动播放
// <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 November 11, 2016 05:41
修改连接跳转页面地址
var opener = parent.window.opener;
opener && (opener.location='http://www.baidu.com/');
@52cik
52cik / git.txt
Created October 9, 2016 06:27
git 强行回退
假设你有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 September 26, 2016 12:15 — forked from nolanlawson/crockford-style.js
Updated IIFE benchmark
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;