Skip to content

Instantly share code, notes, and snippets.

楼教主 52cik

Block or report user

Report or block 52cik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@52cik
52cik / docker-batch-pull.sh
Last active May 31, 2019
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;
@52cik
52cik / ls.js
Created Sep 1, 2016
简易 localStorage/sessionStorage 封装
View ls.js
(function(window, undefined) {
// 编码
function encode(str) {
return encodeURIComponent(JSON.stringify(str));
}
// 解码
function decode(str) {
if (undefined == str) {
@52cik
52cik / .gitattributes
Created Aug 12, 2016
忽略 github 归档文件
View .gitattributes
# Ignore all test and documentation for archive
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/tests export-ignore
/docs export-ignore
You can’t perform that action at this time.