Skip to content

Instantly share code, notes, and snippets.


shane shanezhiu

View GitHub Profile
shanezhiu / uuids.php
Last active Jan 20, 2019
View uuids.php
// 第一种方法
function UUIDS()
if (function_exists('com_create_guid'))
$uuid = com_create_guid();
return substr($uuid, 1, -1);
shanezhiu / HTTP Cookie header parser
Created Dec 5, 2017 — forked from pokeb/HTTP Cookie header parser
Quick and dirty HTTP cookie header parser in PHP
View HTTP Cookie header parser
View 并发并行, 异步同步, 阻塞非阻塞.md



  • 并发:    仅仅包含宏观上的意义,即多个任务同时被处理;而微观上可能仅仅是一个cpu分时间片去完成了多个任务,这个时候多个任务是被顺序处理的。

  • 并行:    则更加严格,在宏观和微观上都应该具有多个任务同时被处理的含义,这个意义上多个任务被并行处理的,单cpu永远不可能并行。

  • 并行和并发是站在两个不同角度上理解产生的概念。

  • 并行一定是并发,并发却不一定是并行。

shanezhiu /
Created Feb 15, 2020 — forked from gtallen1187/
A little bit of slope makes up for a lot of y-intercept

"A little bit of slope makes up for a lot of y-intercept"

01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140

Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.


shanezhiu / quote.txt
Created Apr 21, 2020 — forked from OnesimusUnbound/quote.txt
Programming Quotes
View quote.txt
[T]he difference between a bad programmer and a
good one is whether he considers his code or his
data structures more important. Bad programmers
worry about the code. Good programmers worry about
data structures and their relationships.
-- Linus Torvalds
Clarity and brevity sometimes are at odds.
When they are, I choose clarity.
-- Jacob Kaplan-Moss
shanezhiu / exceptions-tree.php
Created Sep 29, 2020 — forked from mlocati/exceptions-tree.php
Throwable and Exceptions tree
View exceptions-tree.php
if (!function_exists('interface_exists')) {
die('PHP version too old');
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
if (count($throwablesPerParent) !== 0) {
shanezhiu / tmux-cheatsheet.markdown
Created Nov 16, 2020 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程
View tmux-cheatsheet.markdown

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程


tmux [new -s 会话名 -n 窗口名]


shanezhiu /
Created Dec 5, 2020 — forked from jashkenas/
Why Semantic Versioning Isn't

Spurred by recent events (, this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

shanezhiu /
Created Dec 13, 2020 — forked from lisawolderiksen/
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

One of my colleagues shared an article on writing (good) Git commit messages today: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the