Skip to content

Instantly share code, notes, and snippets.

View hipi's full-sized avatar
🐼
Keeping

hipi hipi

🐼
Keeping
  • Arctic
  • 09:08 (UTC +08:00)
View GitHub Profile
@hipi
hipi / urls.json
Created December 30, 2020 02:33
网址列表
[
{
"category": "实用工具",
"icon": "icongongju",
"urls": [
{
"href": "https://www.alltoall.net",
"favicon": "",
"title": "ALL TO ALL",
"description": "多格式支持的在线免费转换"
@hipi
hipi / mouse-heart.js
Created June 30, 2019 08:04
点击心型
(function(window, document) {
window.requestAnimationFrame =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
setTimeout(callback, 1000 / 60);
};
@hipi
hipi / PubSub.js
Last active September 13, 2021 08:07
发布订阅模式
function PubSub() {
this._event = {};
this.on = function (eventName, handler) {
if (this._event[eventName]) {
this._event[eventName].push(handler);
} else {
this._event[eventName] = [handler];
}
};
@hipi
hipi / pac.js
Last active August 26, 2019 08:38
PAC
var proxy = "__PROXY__";
var direct = "DIRECT";
var domains = [
// others
"jsfiddle.net",
"gitter.im",
"greatfire.org",
"tox.im",
"proxifier.com",
"dnscrypt.org",
@hipi
hipi / reset.css
Last active March 18, 2019 06:22
reset 的目的不是让默认样式在所有浏览器下一致,而是减少默认样式有可能带来的问题。
/** 清除内外边距**/
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* 结构元素 - structural elements */
dl, dt, dd, ul, ol, li, /* 列表元素 - list elements */
pre, /* 文本格式元素 - text formatting elements */
form, fieldset, legend, button, input, textarea, /* 表单元素 - from elements */
th, td /* 表格元素 - table elements */ {
margin: 0;
padding: 0;
}
@hipi
hipi / utils.js
Last active June 28, 2021 03:26
常用的工具函数
// 打印颜色字体
const logColor = (text,color="#ffb3cc") => {
console.log("%c " + text, "color: " + color + "; font-weight: bold;")
}
// 随机获取颜色
const getRandomColor = ()=> {
let rgb = []
for (let i = 0; i < 3; ++i) {
let color = Math.floor(Math.random() * 256).toString(16)
@hipi
hipi / image-conversion.js
Created December 21, 2018 01:17
图片压缩
/**
* @file A simple and easy-to-use JS image compression, tools
* @author wangyulue(wangyulue@gmail.com)
*/
(function (factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory()
: typeof define === 'function' && define.amd ? define(factory)
: (window.imageConversion = factory());
}((() => {
@hipi
hipi / polyfills.js
Last active May 5, 2018 00:04
Object.assign, Array.includes polyfills
// Object.assign, Array.includes polyfills
"function" != typeof Object.assign && Object.defineProperty(Object, "assign", {
value: function(t, e) {
"use strict";
if (null == t) throw new TypeError("Cannot convert undefined or null to object");
for (var r = Object(t), n = 1; n < arguments.length; n++) {
var o = arguments[n];
if (null != o)
for (var i in o) Object.prototype.hasOwnProperty.call(o, i) && (r[i] = o[i])
}
@hipi
hipi / rem.js
Last active July 20, 2018 03:09
可伸缩布局方案
/**
* 可伸缩布局方案
* rem计算方式:设计图尺寸px / 100 = 实际rem 【例: 100px = 1rem,32px = .32rem】
*/
console.log(
" %c YUYE %c chenyeah.com ",
"color:#fadfa3;background:#030307;padding:5px 0;border-radius:4px 0 0 4px",
";color:#fff;background:#41b883;padding:5px 0;border-radius:0 4px 4px 0"
);
!(function(window) {