Skip to content

Instantly share code, notes, and snippets.

View 52cik's full-sized avatar

楼教主 52cik

View GitHub Profile
@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 / .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 / 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 / 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 / 1px-gif.html
Created May 21, 2016 13:20
1x1px 透明 gif 的 base64 代码
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=">
@52cik
52cik / address.js
Last active June 4, 2022 13:06
提取淘宝地址库
/**
* 提取淘宝地址库
*
* 用法:
* 1. 打开淘宝 https://www.taobao.com/
* 2. 将下面代码复制到控制台
* 3. 按回车
* 4. 复制输出的 json 数据保存到你的文件
*
* 仅支持: chrome 48+
@52cik
52cik / nginx-yii2.conf
Created April 13, 2016 16:01
nginx yii2 通用配置
listen 80;
charset utf-8;
index index.html index.php;
error_page 404 /404.html;
# 开启 php 并支持 pathinfo
include enable-php-pathinfo.conf;
# yii2 rewrite
@52cik
52cik / debug.js
Created April 9, 2016 03:57
监控js错误并上报
// 源: https://sf-static.b0.upaiyun.com/v-5703995e/global/js/debug.js
/*
监控js错误并上报
wtser@sf.gg
*/
window.onerror = function(msg, url, line, col, error) {
if (msg !== "Script error." && !url) {
return true;
}
@52cik
52cik / client.php
Last active April 4, 2016 09:24
php 伪造IP及来源
<?php
$headers = [ // 构造IP
'CLIENT-IP: 8.8.8.8',
'X-FORWARDED-FOR: 8.8.8.8',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:8000/server.php');
curl_setopt($ch, CURLOPT_REFERER, 'http://www.baidu.com/'); // 构造来路
@52cik
52cik / server_date.js
Created March 31, 2016 03:40
ajax 获取服务器日期
$.ajax('?', {type:'head'}).done(function(data, status, xhr) {
var dt = new Date(xhr.getResponseHeader('Date')); // 字符串转日期对象
console.log(dt.toLocaleString());
});