Skip to content

Instantly share code, notes, and snippets.

View liuyib's full-sized avatar

云泥 liuyib

View GitHub Profile
@liuyib
liuyib / cookie.js
Last active May 5, 2020 15:45
set / get / delete cookie
@liuyib
liuyib / my_utils.js
Last active April 13, 2020 15:58
常用 utils 函数
/**
* 判断是否是字符串
*
* @param {*} val 待判断的值
* @returns {boolean} 是:true,不是:false
*/
function isString(val) {
return typeof val === 'string';
}
@liuyib
liuyib / minimum-image.txt
Last active March 25, 2021 09:31
Minimum image (base64)
<!-- 1 * 1 像素的透明 gif 图片 -->
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">
<!-- 1 * 1 像素(#000000) -->
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=">
<!-- 1 * 1 像素(#f2f2f2) -->
data:image/gif;base64,R0lGODlhAQABAPAAAPLy8gAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==
@geektutu
geektutu / Gitalk-plus-comment.js
Last active December 28, 2022 13:51
模仿disqus的 SEE ALSO ON <blog> 功能,为静态博客添加“显示本站其他文章评论”的功能。 https://geektutu.com/post/blog-experience-7.html
/**
* Generate Comments JSON Data
*/
const https = require('https');
const fs = require('fs');
const github = {
client_id: '<your-client-id>',
client_secret: '<your-client-secret>',
repo: '<your-github-repo>',
@morajabi
morajabi / useRect.js
Created February 18, 2019 14:35
useRect — getBoundingClientRect() React Hook with resize handler
import { useLayoutEffect, useCallback, useState } from 'react'
export const useRect = (ref) => {
const [rect, setRect] = useState(getRect(ref ? ref.current : null))
const handleResize = useCallback(() => {
if (!ref.current) {
return
}
@leohxj
leohxj / .cz-config.js
Last active May 19, 2023 03:49
cz-customizable with emoji
'use strict';
module.exports = {
types: [
{
value: 'WIP',
name : '💪 WIP: Work in progress'
},
{
@motss
motss / browser-support-for-Github.md
Last active July 23, 2019 05:01
Browser Support in Markdown for Github

Microsoft Windows x64

| Internet Explorer | Microsoft Edge | Mozilla Firefox |

@JerryC8080
JerryC8080 / RexChainesPhone.js
Created March 21, 2016 08:08
匹配中国电话号码的正则表达式
/**
电信
中国电信手机号码开头数字
2G/3G号段(CDMA2000网络)133、153、180、181、189
4G号段 177
联通
中国联通手机号码开头数字
@yuezk
yuezk / format-detection.html
Created November 10, 2015 09:16
HTML format-detection meta tag
<meta name="format-detection" content="telephone=no">
<meta name="format-detection" content="date=no">
<meta name="format-detection" content="address=no">
<meta name="format-detection" content="email=no">
@paullewis
paullewis / requestIdleCallback.js
Last active April 23, 2025 04:07
Shims rIC in case a browser doesn't support it.
/*!
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software