Skip to content

Instantly share code, notes, and snippets.

View quan-nh's full-sized avatar
🌗
.

Quân quan-nh

🌗
.
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@quan-nh
quan-nh / datetime.java
Created June 4, 2020 15:22 — forked from salomvary/datetime.java
Java 8 Date and Time Parsing and Formatting Microtutorial
import java.time.format.DateTimeFormatter;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
Instant.now();
// java.time.Instant = 2015-08-13T09:28:27.141Z
DateTimeFormatter.ISO_INSTANT.format(Instant.now());
@quan-nh
quan-nh / richhickey.md
Last active March 6, 2020 14:33 — forked from prakhar1989/richhickey.md
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@quan-nh
quan-nh / keybase.md
Last active February 21, 2019 04:33

Keybase proof

I hereby claim:

  • I am quan-nh on github.
  • I am quannh (https://keybase.io/quannh) on keybase.
  • I have a public key ASALhdAKTdAZjTn2Os-e4FvnCS5iyEB02SF354Wzw_gpJAo

To claim this, I am signing this object:

@quan-nh
quan-nh / [clj].lexical-dynamic-scope.md
Last active April 12, 2022 10:21
Understanding the difference between lexical and dynamic scope in Clojure.

concept

  • lexical scope (static scope): dependent only on the program text.
  • dynamic scope: dependent on the runtime call stack.

clojure

  • (def x 1) default Var is static, using let for local Var, with-redefs to change the root binding var within its scope (visible in all threads).
  • (def ^:dynamic x 1) dynamic Var, using binding to change value (thread-local, cannot be seen by any other thread).

In example bellow:

  • binding only changes the value of *dynamic-var* within the scope of the binding expression