Skip to content

Instantly share code, notes, and snippets.

View 52cik's full-sized avatar

楼教主 52cik

View GitHub Profile
@52cik
52cik / address.js
Last active June 4, 2022 13:06
提取淘宝地址库
/**
* 提取淘宝地址库
*
* 用法:
* 1. 打开淘宝 https://www.taobao.com/
* 2. 将下面代码复制到控制台
* 3. 按回车
* 4. 复制输出的 json 数据保存到你的文件
*
* 仅支持: chrome 48+
@52cik
52cik / 1px-gif.html
Created May 21, 2016 13:20
1x1px 透明 gif 的 base64 代码
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=">
@52cik
52cik / font-family.css
Created May 29, 2016 16:29
font-family 最优重置
/**
* 为了避免字体混乱的局面,Neat.css 统一了 font-family 的设置。
*
* 1. 中文字体选择如下:
* Windows 优先使用「微软雅黑」,如果没有则使用「中易宋体(SimSun)」。
* OS X 优先使用「冬青黑体简体(Hiragino Sans GB)」,如果没有则使用默认的「华文黑体」。
* Linux 优先使用「文泉驿微米黑」。
*
* 2. 西文字体选择如下:
* Windows 优先使用「Arial」。
@52cik
52cik / webkit.html
Last active April 26, 2018 03:41
浏览器webkit内核渲染
<!--360浏览器-->
<meta name="renderer" content="webkit">
<!--其它双核浏览器-->
<meta name="force-rendering" content="webkit">
<!--如果安装了GCF,则使用GCF来渲染页面,如果没有安装GCF,则使用最高版本的IE内核进行渲染。-->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
@52cik
52cik / .gitattributes
Created August 12, 2016 10:27
忽略 github 归档文件
# Ignore all test and documentation for archive
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/tests export-ignore
/docs export-ignore
@52cik
52cik / ls.js
Created September 1, 2016 12:19
简易 localStorage/sessionStorage 封装
(function(window, undefined) {
// 编码
function encode(str) {
return encodeURIComponent(JSON.stringify(str));
}
// 解码
function decode(str) {
if (undefined == str) {
@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;
@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 / opener.js
Created November 11, 2016 05:41
修改连接跳转页面地址
var opener = parent.window.opener;
opener && (opener.location='http://www.baidu.com/');
@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);