Skip to content

Instantly share code, notes, and snippets.

View gucheen's full-sized avatar

Cheng Gu gucheen

View GitHub Profile
@gucheen
gucheen / change-git-profile.sh
Created August 28, 2020 09:09
easily change git profile
alias git_as_gucheng='git config user.name "Cheng Gu" && git config user.email "guchengf@gmail.com" && git config user.signingKey xxxxx'
@gucheen
gucheen / douyu-dark.css
Created April 9, 2020 14:32
douyu-dark.css
@-moz-document domain("www.douyu.com") {
.layout-Player-toolbar,
.layout-Player-asideMain,
.layout-Player-announce,
.ChatRank-rankWraper,
.FansRankInfo,
.ChatTabContainer-titleWraper--tabLi,
.ChatTabContainer-titleWraper--tabLi.is-active,
.layout-Player-barrage,
.PlayerToolbar-signCont {
@gucheen
gucheen / readablizeBytes.js
Created March 4, 2014 09:02
文件大小单位转换
function readablizeBytes(bytes) {
var s = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
}
interface ModernOrgTreeOptions {
container: HTMLElement;
nodes?: NodeList;
parentPosition?: string;
childPosition?: string;
}
export class ModernOrgTree {
parentsPositions = {};
svg;
@gucheen
gucheen / doc.css
Last active May 28, 2019 01:37
css for documentation
body,html{
margin:0
}
body{
padding:2em
}
a{
word-break:break-all
}
pre{
@gucheen
gucheen / generateQueryParams.js
Last active May 17, 2019 07:10
generate query params from object like URLSearchParams()
const generateQueryParams = (obj) => {
if (typeof obj !== 'object') {
return '';
}
const strs = [];
Object.keys(obj).forEach((key) => {
const k = encodeURIComponent(key);
const item = obj[key];
if (Array.isArray(item)) {
item.forEach((i) => {
@gucheen
gucheen / 读书记录.md
Last active February 16, 2019 03:06
读书记录
  • 柔软的宇宙
  • 时间的形状
  • 太空全书
  • 星空的琴弦

软件

ack
aria2
asciinema
bat
ctags
curl
diff-so-fancy
fd
@gucheen
gucheen / 多态邀请码
Created May 31, 2017 04:56
多态邀请码
A15B-A7F3-A6A4-23
@gucheen
gucheen / index.html
Created August 9, 2018 09:44
Radio Toggle Switch
<fieldset class="radio-switch">
<legend>
Settings
</legend>
<input type="radio" name="lol" id="public">
<label for="public">
On
</label>
<input type="radio" name="lol" id="private">