Skip to content

Instantly share code, notes, and snippets.

解决 Git 在 windows 下中文乱码的问题

原因

中文乱码的根源在于 windows 基于一些历史原因无法全面支持 utf-8 编码格式,并且也无法通过有效手段令其全面支持。

解决方案

  1. 安装
@liyann
liyann / animation.html
Created October 1, 2017 05:49
animation实现"点点点"动态加载效果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.ani_dot {
@liyann
liyann / 0_reuse_code.js
Created September 5, 2017 09:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/**
* Created by Li on 2017/3/26.
*/
function swap(array, i, j) {
let temp
temp = array[i]
array[i] = array[j]
array[j] = temp
return array
}
git push origin --delete <branchName>
function commafy(num){
return num && num
.toString()//匹配一个数字,条件是后面跟着三个数字一次或多次,且末尾"."
.replace(/(\d)(?=(\d{3})+\.)/g, function($1, $2){
console.log($1,$2)
return $1 + ',';
});
}
console.log(commafy(1234355645.1343))
function Promise(fn) {
var state = 'pending',
value = null,
callbacks = []
this.then = function(onFulfilled) {
return new Promise(function(resolve) {
//handle方法是当前 promise 的内部方法
handle({
onFulfilled: onFulfilled || null, //上一个promise的回调
@liyann
liyann / ellipsis.css
Last active August 6, 2017 02:04
使用css解决单行文本超出省略
.selector{
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;/*不换行*/
width: 50%;
}
@liyann
liyann / index.md
Last active August 16, 2017 06:29
storage
  1. localStorage理论上来说是永久有效的,即不主动清空的话就不会消失,即使保存的数据超出了浏览器所规定的大小,也不会把旧数据清空而只会报错。   但需要注意的是,在移动设备上的浏览器或各Native App用到的WebView里,localStorage都是不可靠的,可能会因为各种原因(比如说退出App、网络切换、内存不足等原因)被清空。
  2. sessionStorage的生存期顾名思义,类似于session,只要关闭浏览器(也包括浏览器的标签页),就会被清空。由于sessionStorage的生存期太短, 因此应用场景很有限,但从另一方面来看,不容易出现异常情况,比较可靠。    
  3. Git也允许手动建立追踪关系:git branch --set-upstream master origin/next
@liyann
liyann / cloudSettings
Last active July 17, 2017 09:31
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-07-17T09:31:16.435Z","extensionVersion":"v2.8.2"}