Skip to content

Instantly share code, notes, and snippets.

View annhienktuit's full-sized avatar
💭
newbie

Nhien Nguyen annhienktuit

💭
newbie
  • Zalo
  • Vietnam
View GitHub Profile
@annhienktuit
annhienktuit / SampleChain.java
Last active December 12, 2021 15:19
A sample blockchain written in Java
import java.security.MessageDigest;
import java.util.*;
class Block {
private String hash;
private String previousHash;
private String data;
private long timeStamp;
private int nonce;
public Block(String data, String previousHash, long timeStamp){
@annhienktuit
annhienktuit / why-newline.md
Created July 19, 2024 10:53 — forked from OleksiyRudenko/why-newline.md
Why should text files end with a newline?

Why should text files end with a newline?

Reasons:

  • UNIX standard
  • If the last line in a file doesn't end with a newline then addition of next line affects two lines instead of one. This also pollutes diff on multiple files, so reader may wonder what has changed in a line whereas no significant change has occured.

Multiple newlines at the file end are also redundant as well as spaces at the end of line.