You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
💼
On the hunt...
Luis Uceta
uzluisf
💼
On the hunt...
Bachelor in CompSci | Hunter College Alumni
gitlab.com/uzluisf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NodeJS handles raw binary data with the classes Buffer and Blob, while Raku does so with the roles Buf and Blob, which are mutable and immutable buffers respectively. In Raku, a Buf composes a Blob so all Blob methods are available to Buf objects.
The following table summarizes the similarities and differences between buffer constructs in NodeJS and Raku:
NodeJS
Raku
Buffer/Buf
Fixed-length sequence of bytes (No methods such as push, pop, etc.)
Sequence of bytes that can grow or shrink dynamically. You can use methods such as push, pop, etc.
Iterable using the for..of syntax
It cannot be iterated over using a looping construct. Use the method list to get hold of an iterator.
You can get collapsible blocks in Github Markdown by using the <details></details> and <summary></summary> tags. For example,
<details><summary>Poe's Law (click to expand)</summary>
A humorous law of Internet forums, stating that "The best way to get the right answer on
the Internet is not to ask a question; it's to post the wrong answer."
There are several differences between sigilless and sigilled variables, which are already documented in the Raku docs. This is simply my attempt at consolidating them in a single place.
Sigil
At the surface, a sigil or lack thereof is the most apparent difference between sigilless and sigilled variables. As their names imply, sigilless variable don't have sigils while sigilled variables do.
Without a clear indicator of the author's intent, any parodic or sarcastic expression of extreme views can be mistaken by some readers for a sincere expression of those views.
The JsonLineParser class implements a transform stream (using Node.js v20.2.0's Stream API) to parse a file that contains JSON objects separated by newlines (See data.ndjson). It's adapted from Young and Harter's Node.js in Practice book, especifically Technique 31: Implementing a readable stream.
subcreate-table(:@headers, :@columns, Bool:$markdown=False-->Nil) {
unless@headers.elems==@columns.elems {
$*ERR.spurt:"Table is out of shape: Number of headers must be equal to number of columns.\n";
$*ERR.flush;
return;
Working with binary data is kind of like solving a puzzle. You’re given clues by reading a specification of what the data means and then you have to go out and turn that data into something usable in your application.
— Young and Harter’s NodeJS in Practice
Text files, images, videos and anything you can store in a computer have a thing in common: all of them are stored as binary data. We make sense of what a sequence of binary data refers to purely based on how we interpret the binary data, and whether it conforms to what we expect it to be. If some chunk of binary data holds any meaning, we can tell it apart from another chunk by using a binary format specification, which describes how some binary data ought to be interpreted. For example, in the dBASE specification the first 32 bytes make up the header, which contains information such as date of last update, number of records in the database file, etc. Every binary file format you can ima