给博客换新颜

小日子

2019.06.28

给博客换新颜

最近给博客匆匆换了主题,顺便打理一下这个荒废了很长一段时间的博客,重新投入使用。

临时关闭 Mac SIP 修改自带词典字体

Tutorials

2019.03.16

临时关闭 Mac SIP 修改自带词典字体

最近用词典比较多,而 Mac 自带词典不得不说非常好用,还能自己编译、安装一些第三方的词典。稍有遗憾的是,自带词典的字体目前(Mojave)不能任意修改,需要临时关闭 SIP (System Integrity Protection, 系统完整性保护) 才能添加自定义 CSS。

The Countinuation-Passing Style in JavaScript

JavaScript Notes

2018.12.21

The Countinuation-Passing Style in JavaScript

In JavaScript, a callback is a function that is passed as an argument to another function and is invoked with the result when the operation completes. In functional programming, this way of propagating the result is called continuation-passing style (CPS). It simply indicates that a result is propagated by passing it to another function (the callback), instead of directly returning it to the caller.

Practising closures in JavaScript

JavaScript Notes

2018.12.17

Practising closures in JavaScript

JavaScript is a very function-oriented language. As we know, functions are first class objects and can be easily assigned to variables, passed as arguments, returned from another function invocation, or stored into data structures. A function can access variable outside of it. But what happens when an outer variable changes? Does a function get the most recent value or the one that existed when the function was created? Also, what happens when a function invoked in another place - does it get access to the outer variables of the new place?

Get a JavaScript array with unique values

JavaScript Notes

2018.05.11

Get a JavaScript array with unique values

As I need to update an array in Firebase Cloud Firestore with duplicate-free values, let's summarise the methods I found and see how they perform.