Notes on Maintainable JavaScript

Part one covers coding style to make team code look as if written by a single person. Part two covers programming practices, with many valuable JavaScript programming lessons. Part three is about automation, but the toolchain it introduces feels quite outdated by the end of 2016.

Read more

Notes on JavaScript: The Good Parts

I recently bought a few books, and this “JavaScript: The Good Parts” truly lives up to its name. It’s short in length with extensive appendices. The author is Douglas Crockford, the inventor of JSON – sounds impressive, and indeed the book is packed with insights. I benefited greatly from reading it!

Read more

What Is Currying Actually Useful For in Functional Programming?

Functional programming has been increasingly active lately. When I was interning last year, I bought a copy of “Functional Programming in JavaScript,” read through it hastily with only a vague understanding. After re-reading it this year, I’m writing this blog post to share my understanding of currying.

Read more

Wrapping Webview JSBridge Interfaces

Our company’s existing JSBridge solution had cumbersome invocations, deeply nested parameters, and compatibility issues across multiple apps, drawing widespread complaints from our frontend developers…

Read more

Getting Started with Node.js WeChat Official Account Development

Setting up a server: WeChat Official Account development requires a server to receive and process messages. I recommend applying for a free cloud server from Tencent Cloud, click here to apply, available at 9:30 AM daily. I chose Ubuntu as the server image. For how to set up a Node environment on the server, refer to my other blog post Using Linux for Web Frontend Development. The principle of Official Account development is to set up a receiving interface; once developer mode is enabled, WeChat’s server will forward messages to this interface.

Read more

The Vanishing 1px Border

I previously wrote an article about the 1px border issue: From line-height to 0.5px. The scaling approach works, but when using rem or percentage units, the 1px border often disappears on certain devices. The border-image approach doesn’t have this disappearing issue. This article explores why the 1px border disappears and why the latter renders correctly.

Read more

Web Frontend Development on Linux

Why use Linux? While Mac has countless advantages, its relatively high price puts many students off. When I started my internship last year, I was using Windows 7, and the command-line experience was truly painful—especially for web frontend development where countless tools run in the terminal, such as numerous Node.js tools. Switching to Linux made everything much smoother.

Read more

Node.js Morgan Module and Cluster Module

I’ve been tinkering with Node.js recently, following along with “Node.js in Action” to implement the Microblog project. Since the book was written in 2012, and Node has since been updated to v5.9.0 with Express also having undergone significant changes, much of the code in the book no longer works with current versions. For the implementation details, you can refer to this article: “Node.js Development Guide” Microblog Example with Express 4.x. BTW, the Express startup command has changed to npm start, which executes the www file in the bin directory, equivalent to running node ./bin/www directly. This post briefly covers the logging and multi-core CPU optimization topics mentioned in Chapter 6, along with an introduction to a debug tool. The complete Microblog code is available on GitHub: Click here

Read more