NodeJS Dependencies

  • using the npm utility to manage node.js packages
  • dependencies are saved in packages.json
  • dependencies in package.json get installed whenever you run npm install without any arguments
  • run npm install –save to persist dependencies in package.json
  • run npm install -g [package] to install package to a folder that is in the PATH environment variable
  • run npm install [package] to install package to the project folder, node_modules
  • the project-level folder, node_modules, should be ignored in version control. (add a line containing node_modules to .gitignore in git)

Logic and Philosophy

  • argument (論述)
    • an argument is a series of statements typically used to persuade someone of something or to present reasons for accepting a conclusion.
    • In logic, an argument requires a set of (at least) two declarative sentences (or “propositions“) known as the premises along with another declarative sentence (or “proposition”) known as the conclusion.
    • 典型的邏輯論述(三段論):
      • 世界上只有一個中國 (premise)
      • 台灣是中國的一部份 (premise)
      • 中華人民共和國政府是中國的唯一合法政府 (conclusion)
  • statement (敘述/主張)
    • In logic, a statement is either (a) a meaningful declarative sentence that is either true or false,
    • or (b) that which a true or false declarative sentence asserts
  • proposition (命題/主張)
    • It is used to refer to some or all of the following: the primary bearers of truth-value, the objects of belief and other “propositional attitudes” (i.e., what is believed, doubted, etc.), the referents of that-clauses and the meanings of declarative sentences.
    • Propositions are the sharable objects of attitudes and the primary bearers of truth and falsity.
  • premise (前提)
    • A premise is a statement that an argument claims will induce or justify a conclusion.
    • In other words: a premise is an assumption that something is true.  
  • condition (條件)
    • the Cambridge Dictionary of Philosophy defines ‘condition’ in an important sense not explained above: a condition is a state of affairs, “way things are” or situation—most commonly referred to by a nominalization of a sentence.
  • state of affairs
    • In philosophy, a state of affairs, also known as a situation, is a way the actual world must be in order to make some given proposition about the actual world true; in other words, a state of affairs (situation) is a truth-maker, whereas a proposition is a truth-bearer. Whereas states of affairs (situations) either obtain or fail-to-obtain, propositions are either true or false.
  • sentence
    • declarative sentence or declaration (陳述句)
    • interrogative sentence or question (疑問句)
    • exclamatory sentence or exclamation (驚歎句)
    • imperative sentence or command (祈使句)
  • Necessity and sufficiency

JSON and Constructor function


The baby step for DOM manipulation


JavaScript function ABC: apply(), bind() and call()

  • apply()
    • The apply() method calls a function with a given this value and arguments provided as an array (or an array-like object).
  • bind()
    • The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
  • call()
    • The call() method calls a function with a given this value and arguments provided individually.
    • Note: While the syntax of this function is almost identical to that of apply(), the fundamental difference is that call() accepts an argument list, while apply() accepts a single array of arguments.


Don’t buy Kingston DataTraveler USB 3.0 (DT101G3)

Bruce bought two pieces of DataTraveler USB 3.0 128GB (DT101G3) yesterday and found out that it is actually a USB 2.0 equivalent product in terms of data transfer rate (but it is equipped with a USB 3.0 interface indeed).

Kingston lures consumers with the USB 3.0 interface but sidesteps the issue of poor data transfer rate. In terms of this, DataTraveler USB 3.0 (DT101G3) is a fake USB 3.0.

Don’t buy it. I was really disappointed with these sneaky marketing tricks from Kinston.

Handy Tools