Results for “Type & reading flow”
Small, practical examples. Search by task or narrow things down below.
Read the byte size of a regular file
C++: file_size reads filesystem metadata without loading file contents.
C++✓ Tested
Read the current branch name
Git: show-current returns an empty string when HEAD is detached.
Git✓ Tested
Read the directory portion of a path
Linux Commands: Read the directory portion of a path using GNU/Linux commands in an empty practice directory.
Linux Commands✓ Tested
Read the end of piped text
Linux Commands: Read the end of piped text using GNU/Linux commands in an empty practice directory.
Linux Commands✓ Tested
Read the exact version currently staged
Git: The colon path syntax reads a blob from the index rather than from HEAD or the working file.
Git✓ Tested
Read the filename portion of a path
Linux Commands: Read the filename portion of a path using GNU/Linux commands in an empty practice directory.
Linux Commands✓ Tested
Read the final array item with a negative index
JavaScript: at supports negative positions counted from the end.
JavaScript✓ Tested
Read the first array element
Bash Scripts: Read the first array element with a small standalone Bash program.
Bash Scripts✓ Tested
Read the first collection element
Python: Access index zero only after establishing that the collection is nonempty.
Python✓ Tested
Read the first collection element
C#: Access index zero only after establishing that the collection is nonempty.
C#✓ Tested
Read the first collection element
Java: Access index zero only after establishing that the collection is nonempty.
Java✓ Tested
Read the first collection element
JavaScript: Access index zero only after establishing that the collection is nonempty.
JavaScript✓ Tested