Skip to content

Instantly share code, notes, and snippets.

@shawn-yee
shawn-yee / code_style.md
Created February 20, 2021 05:02 — forked from jesseschalken/code_style.md
Code style

My preferred code style is 2-space K&R. This is intended to provide a justification for this style.

Why K&R?

K&R style has the following properties:

  1. Provides symmetric size (in terms of screen space consumed) between the opening and closing syntax of a clode block.
  2. Forces no empty or meaningless lines, thereby avoiding artificial distance between related things that should be together.
  3. Consumes the minimum vertical space while keeping the opening and closing syntax of a block on separate lines from the content.
@shawn-yee
shawn-yee / 100+ different counter apps...
Created October 19, 2020 16:25 — forked from srdjan/100+ different counter apps...
More than 100 different counter applications...
100+ different js counter applications...
@shawn-yee
shawn-yee / FrontendFrameworksPopularity.md
Created September 18, 2020 15:45 — forked from tkrotoff/FrontendFrameworksPopularity.md
Front-end frameworks popularity (React, Vue and Angular)

Findings: React is by far the most popular front-end framework (and continues to grow faster), except for the GitHub stars. In addition, React is more loved and "wanted" than other front-end frameworks (although it is more used: satisfaction tends to decrease with popularity).

Charts are from different sources and thus colors are inconsistent, read the chart's legends instead.

NPM downloads

npm-stat.com

@shawn-yee
shawn-yee / index.js
Created September 6, 2020 11:45 — forked from lygaret/index.js
ES6 Quasi-Literal for JSX
define(function(require) {
var React = require('react');
var paramRegex = /__(\d)+/;
var parser = new DOMParser();
var errorDoc = parser.parseFromString('INVALID', 'text/xml');
var errorNs = errorDoc.getElementsByTagName("parsererror")[0].namespaceURI;
// turns the array of string parts into a DOM
// throws if the result is an invalid XML document.
作者:一绊
链接:https://www.zhihu.com/question/20117388/answer/62263969
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
问题:
服务器是ubuntu,用Mac的iterm2 ssh连上去,终端显示中文乱码,也不能输入中文,然而本地终端可以显示和输入。
解决方法:
这种情况一般是终端和服务器的字符集不匹配,MacOSX下默认的是utf8字符集。
输入locale可以查看字符编码设置情况,而我的对应值是空的。