0%

1. 听书《浴血三八线》合集
2. 听书《太白金星有点烦》合集
3. 听书《黄卡》合集
4. 听书《回响》合集
5. 听书《在西南联大》合集
6. 听书《我与地坛》合集
7. 听书《刻骨铭心》合集
8. 听书《我不是潘金莲》合集
9. 听书《无穷镜》合集
10. 听书《边城》合集
11. 听书《省委书记》合集
12. 听书《毛泽东最后七年风雨路》合集
13. 听书《全世界只有一个你》合集
14. 听书《围城》合集
15. 听书《草房子》合集
16. 听书《芙蓉镇》合集
17. 听书《南渡北归》合集
18. 听书《活着》合集
19. 听书《红色惊悸》合集
20. 听书《呼兰河传》合集
21. 听书《抉择》合集
22. 听书《南渡北归-离别》合集
23. 听书《蛙》合集
24. 听书《历史的天空》合集
25. 听书《北去来辞》合集
26. 听书《我们仨》合集
27. 听书《北平风物》合集
28. 听书《白鹿原》合集
29. 听书《茶人三部曲》合集
30. 听书《南方有嘉木》合集
31. 听书《不夜之侯》合集
32. 听书《筑草为城》合集
33. 听书《暗算》合集
34. 听书《简爱》合集
35. 听书《苏东坡传》合集
36. 听书《书剑恩仇录》合集
37. 听书《恋习生》合集
38. 听书《高兴》合集
39. 听书《秋天死于冬季》合集
40. 听书《失落的秘符》合集
41. 听书《乔家大院》合集
42. 听书《兄弟三个半》合集
43. 听书《陆犯焉识》合集
44. 听书《李鸿章传》合集
45. 听书《檀香刑》合集
46. 听书《古炉》合集
47. 听书《枪炮、病菌与钢铁》合集
48. 听书《鸽群中的猫》合集
49. 听书《唐人街》合集
50. 听书《怪屋》合集
51. 听书《故事照亮未来》合集
52. 听书《千里江山图》合集
53. 听书《望春风》合集
54. 听书《我们》合集
55. 听书《大陕北》合集
56. 听书《浮躁》合集
57. 听书《我们如此相爱》合集
58. 听书《雅舍窗前青青草》合集
59. 听书《三色堇》合集
60. 听书《宝水》合集
61. 听书《山月不知心底事》合集
62. 听书《上海的早晨》合集
63. 听书《红楼梦》合集
64. 听书《四妹子》合集
65. 听书《母亲》合集
66. 听书《无人生还》合集
67. 听书《民国风云》合集
68. 听书《侯卫东官场笔记》合集
69. 听书《庄园的午餐》合集
70. 听书《新围城》合集
71. 听书《启蒙时代》合集
72. 听书《我曾纯粹爱过你》合集
73. 听书《一个红卫兵的自白》合集
74. 听书《大明王朝1566》合集
75. 听书《球状闪电》合集
76. 听书《锅盖头》合集
77. 听书《沉沦的土地》合集
78. 听书《沉重的翅膀》合集
79. 听书《黄河东流去》合集
80. 听书《潜伏》合集
81. 听书《额尔古纳河右岸》合集
82. 听书《黑坟》合集
83. 听书《我的名字叫红》合集
84. 听书《黄雀记》合集
85. 听书《傅雷家书》合集
86. 听书《娜娜》合集
87. 听书《与律师同居的日子》合集
88. 听书《长相思》合集
89. 听书《大丈夫》合集
90. 听书《阳台见》合集
91. 听书《被弃的皇妃》合集
92. 听书《​知青》合集
93. 听书《刚刚好的你》合集
94. 听书《一颗子弹与一部红色经典》合集
95. 听书《苔丝》合集
96. 听书《新说资治通鉴》合集
97. 听书《​使命》合集
98. 听书《​青木川》合集
99. 听书《​永和关》合集
100. 听书《​北鸢》合集
101. 听书《爱玛》合集
102. 听书《一句顶一万句》合集
103. 听书《欢乐颂》合集
104. 听书《记忆与印象》合集
105. 听书《高位出局》合集
106. 听书《北风那个吹》合集
107. 听书《双城记》合集
108. 听书《一九八四》合集
109. 听书《金粉世家》合集
110. 听书《月唐演义》合集
111. 听书《镜花缘》合集
112. 听书《煮酒探西游》合集
113. 听书《潘多拉的阴谋》合集
114. 听书《冬天里的春天》合集
115. 听书《永别了,武器》合集
116. 听书《红星照耀中国》合集
117. 听书《汤姆叔叔的小屋》合集
118. 听书《许茂和他的女儿们》合集
119. 听书《遥远的救世主》合集
120. 听书《爱情万岁》合集
121. 听书《吕梁英雄传》合集
122. 听书《神雕侠侣》合集
123. 听书《天龙八部》合集
124. 听书《我是猫》合集
125. 听书《菊花香》合集
126. 听书《​​深圳往事》合集
127. 听书《​​好爹好娘》合集
128. 听书《​万历十五年》合集
129. 听书《​河洛图》合集
130. 听书《八月桂花遍地开》合集
131. 听书《山海经》合集
132. 听书《失乐园》合集
133. 听书《曹雪芹与红楼梦》合集
134. 听书《中国丁克》合集
135. 听书《一厘米的阳光》合集
136. 听书《所以》合集
137. 听书《瓷骨》合集
138. 听书《敦煌本纪》合集
139. 听书《张震回忆录》合集
140. 听书《梦落大唐》合集
141. 听书《理智与情感》合集
142. 听书《名利场》合集
143. 听书《男儿行处即长城》合集
144. 听书《医药代表》合集
145. 听书《列那狐的故事》合集
146. 听书《蹉跎岁月》合集
147. 听书《孔雀森林》合集
148. 听书《战上海》合集

turf topojson three lodash

1
2
3
4
5
6
7
8
9
10
11
import { onMounted, onUnmounted, nextTick, ref } from "vue";
import * as turf from "@turf/turf";
import mymap from "./../../views/dmap/components/sgmap/index.vue";
// import mymap from "./components/mapbox/index.vue";
// import mapboxgl from "mapbox-gl";
// import * as THREE from "three";
// import { debounce } from "lodash";
// import _ from 'lodash';

import * as d3 from "d3";
import * as topojson from "topojson";

d3

1
npm install --save d3

if TypeScript

1
npm install --save-dev @types/d3
1
import * as d3 from "d3";

map style

Mapbox-owned style:

  • mapbox://styles/mapbox/standard
  • mapbox://styles/mapbox/streets-v12
  • mapbox://styles/mapbox/outdoors-v12
  • mapbox://styles/mapbox/light-v11
  • mapbox://styles/mapbox/dark-v11
  • mapbox://styles/mapbox/satellite-v9
  • mapbox://styles/mapbox/satellite-streets-v12
  • mapbox://styles/mapbox/navigation-day-v1
  • mapbox://styles/mapbox/navigation-night-v1.

1
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

查看

1
nvm ls

使用最新

1
nvm use node

设置默认

1
nvm alias default v12.13.0
1
2
3
4
5
6
7
8
9
10
11
12
$ nvm use 16
Now using node v16.9.1 (npm v7.21.1)
$ node -v
v16.9.1
$ nvm use 14
Now using node v14.18.0 (npm v6.14.15)
$ node -v
v14.18.0
$ nvm install 12
Now using node v12.22.6 (npm v6.14.5)
$ node -v
v12.22.6

阅读内容 录音

1
say -f 1.txt -o 1.aiff

转 mp3

1
lame -m m 1.aiff 1.mp3

clientX vs pageX

1
2
3
4
5
6
let i = 0;

while (i < scores.length) {
console.log(scores[i]);
i++;
}
1
2
3
4
5
6
let i = 0;

do {
console.log(scores[i]);
i++;
} while (i < scores.length);
1
2
3
for (let i = 0; i < scores.length; i++) {
console.log(scores[i]);
}
1
2
3
for (i in scores) {
console.log(scores[i]);
}
1
2
3
for (score of scores) {
console.log(score);
}

forEach

map

reduce

reduceRight

flatMap

filter

every

some

indexOf

lastIndexOf

find

findIndex

keys

entries

includes

Spread …

via https://www.w3schools.com/js/js_array_iteration.asp

via https://www.w3schools.com/jsref/jsref_obj_array.asp

at

1
2
const fruits = ["Banana", "Orange", "Apple", "Mango"];
let fruit = fruits.at(-2);

array.slice(start, end)

The slice() method does not change the original array.

array.splice(index, howmany, item1, ….., itemX)

The splice() method overwrites the original array.

copyWithin

array.copyWithin(target, start, end)

Tools -> Developer -> New Snippet…

1
2
3
4
5
6
<snippet>
<content><![CDATA[console.log($1);$0]]></content>
<tabTrigger>log</tabTrigger>
<scope>text.plain,source.js,source.ts</scope>
<description>console.log()</description>
</snippet>

保存为 log.sublime-snippet

使用:

log+回车

npm –save 和–save-dev的区别

使用–save 安装的包是项目发布之后还需要依赖的包, 如axiox , express等包,等项目上线以后还需使用。

使用–save-dev 安装的包则是开发时依赖的包,等项目上线则不会使。

npm install 和 npm i 是一样

–save 和 -S 是一样
–save-dev 和 -D 是一样的

tsc

1
2
3
4
npm i tsc -D
npx tsc --init

npx tsc -w

任何 1.ts 生成 1.js

也可以修改 tsconfig.json 配置

1
2
// "outFile":"./",
// "outDir": "./",

类型

  • boolean

  • number

  • string

  • Explicit

  • Implicit

1
let firstName: string = "Dylan";

unknown 比 any 安全

1
2
3
let w: unknown = 1;

let v: any = true;

date 性能

1
2
3
Date.now()  // 最快
new Date().getTime();
+new Date // 最慢

via https://www.measurethat.net/Benchmarks/Show/9412/0/new-date-vs-new-dategettime-vs-datenow-100k

interface 和 type 区别

  • 接口是通过继承的方式来扩展,类型别名是通过 & 来扩展。
  • 接口可以自动合并,而类型别名不行

https://zhuanlan.zhihu.com/p/351213183

到底应该用 type 还是 interface ?
Because an interface more closely maps how JavaScript objects work by being open to extension, we recommend using an interface over a type alias when possible.
On the other hand, if you can’t express some shape with an interface and you need to use a union or tuple type, type aliases are usually the way to go.

意思是说能用 interface 的地方就用 interface,否则用 type,其实这个解释官方说的也比较明确,这样使用的原因是因为更贴合 JavaScript 对象的工作方式,再清晰一些,如果我们是定义一个 object,那么最好是使用 interface 去做类型声明,什么时候用 type 呢,当定义一个 function 的时候,用 type 会更好一些

1
2
3
4
// the `?` operator here marks parameter `c` as optional
function add(a: number, b: number, c?: number) {
return a + b + (c || 0);
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Person {
private name: string;

public constructor(a: string) {
this.name = a;
}

public getName(): string {
return this.name;
}
}

const person = new Person('david');

console.log(person)

//console.log(person.name)

console.log(person.getName())

class Property ‘’ has no initializer and is not definitely assigned in the constructor

  1. tsconfig.json 关掉严格
1
2
3
"compilerOptions": {
"strictPropertyInitialization":false
}
  1. undefined
1
employees : Employee[] | undefined;
  1. definite assignment assertion
1
employees!: Employee[];
  1. init
1
employees: Employee[] = [];
  1. Assignment in the Constructor

employees: Employee[];

constructor() {
this.employees=[];
}

super

父级构造函数

?? 对比 ||

使用 ?? 时,只有当值1为null或undefined时才返回值2;

使用 || 时,值1会转换为布尔值判断,为true返回值1,false 返回值2

0: Main button pressed, usually the left button or the un-initialized state

1: Auxiliary button pressed, usually the wheel button or the middle button (if present)

2: Secondary button pressed, usually the right button

3: Fourth button, typically the Browser Back button

4: Fifth button, typically the Browser Forward button

下载的美剧是1目录1集,想考出来

a1/a1.mp4
a2/a2.mp4

->

a1.mp4
a2.mp4

1
find . -type f -exec mv {} ./ \;

报错!重名!

a1.mp4/a1.mp4
a2.mp4/a2.mp4

1
find . -type f -exec mv {} ../ \;

那就往上一层(然后删除空目录,再考回去)