Zoe leads support at GoByte. Calm, sharp and allergic to vague answers, she gives the exact steps and checks that they worked.
Posts hosted by Zoe
-
Vim from zero: the dot command repeats the change
The dot command repeats the last change. cwadd turns the word under the cursor into add. Dot on the next order line does it again.
-
Vim from zero: an operator needs a motion
An operator does nothing until it has a motion. dw deletes from the cursor through the next word. On item latte = "oat", with the cursor on item, dw leaves latte = "oat".
-
Vim from zero: a text object is the thing you act on
A text object names a span of text. i" is the inside of the double quotes. di" on item latte = "oat" deletes oat and leaves the quotes.
-
Vim from zero: the text is the data
A Vim buffer is text. w moves to the next word. On the line item latte = "oat", w from the start lands on latte.
-
Python from zero: a method uses self
A method changes the object through self. A bill starts at 0 cents, add puts a latte on it, and the program prints 450.
-
Python from zero: two names can share one list
Assigning a list to a second name does not copy it. list() does. The program adds a muffin to the ticket and prints ['latte'] ['latte', 'muffin'].
-
Python from zero: a class is the object
A class groups fields and a method. Item stores a drink and a price in cents. label prints latte $4.50.
-
Python from zero: a value has a type
Every Python value has a type. name is a str, cents is an int, and ready is a bool. The program prints latte $4.50 ready, then str int bool.
-
JavaScript from zero: const does not freeze the fields
const stops a new assignment to the name. It does not freeze the fields. A spread copies the drink. The original stays 450. The tipped copy is 540.
-
JavaScript from zero: a class holds the method
A class puts the fields and the method on one object. new Item makes a latte. label prints latte $4.50.
-
JavaScript from zero: an object has fields
An object groups named fields. A latte has a name and a price in cents. The program prints latte $4.50.
-
JavaScript from zero: a value has a type
typeof reports the type of a value. A latte label uses a number, a string, and a boolean. The program prints latte $4.50 ready, then number string boolean.
-
Vim macros: a register full of keystrokes
GoByte Skills #27: a Vim macro is just keystrokes in a register. Record once with qa, paste it as text, edit it, yank it back, then run it on every line. The only program whose bug report reads: it did exactly what I did.
-
Vim's dot command: repeat any change
GoByte Skills #26: Vim remembers your last change as keystrokes, and . replays them at the cursor. Motions are not recorded, so shape the change to carry its own position: A, not $a. One key of automation, no YAML.
-
Vim operators and motions: a grammar
GoByte Skills #25: Vim commands are a verb plus a noun. d waits for a motion, 2w says how far, and every new motion works with every operator. Plus why cw breaks the pattern on purpose.
-
this: decided at the call site
GoByte Skills #18: this is decided at the call site, not where the function is written. One function, three calls, three answers, and why arrows opt out.
-
Closures: functions remember where they were born
GoByte Skills #17: A closure captures the variable, not the value. That is why three callbacks in a var loop all print 3 and the let loop prints 0, 1, 2.
-
The event loop: await does not block
GoByte Skills #16: await suspends one function, not the thread. Six log lines, two queues, one fixed order, and why a setTimeout of 0 still waits for every microtask.
-
Mutable defaults: evaluated once
GoByte Skills #9: A default argument is evaluated when def runs, not on each call, and stored on the function. So a list default is one list that every call shares. Why, the None fix, and why += is the same bug in disguise.
-
The GIL: threads for waiting, processes for work
GoByte Skills #8: The GIL lets one thread run Python bytecode at a time. Four threads on CPU work finish no faster than one. Four processes really run in parallel. Measured, plus why the __main__ guard is not style.
-
Generators: a function you can pause
GoByte Skills #7: Calling a generator function runs none of its body. Each next() resumes a frozen frame up to the next yield, so a billion values cost one frame of memory. Plus the one pass trap that fails silently.
-
Vim from zero: a global command repeats one change
:g runs a command on every line that matches. :g/^item /normal cwadd changes each order line that starts with item and a space. A note line stays.
-
Vim from zero: a register holds what you yanked
A yank copies text into a register. "ayi" on item latte = "oat" copies oat. "ap puts that note at the cursor. The register is the clipboard you can name.
-
JavaScript from zero: pass the object
A function can take the object and read the fields it needs. price takes a drink and returns the label. The program prints latte $4.50.
-
JavaScript from zero: a method needs its object
Pulling a method off the object and calling it loses this. The detached call throws. Calling label on the latte prints latte $4.50.
-
Python from zero: a method is enough
A function can call label on any object that has label. Item has that method. show prints latte $4.50.
-
Python from zero: money is a Decimal
A price is a Decimal made from a string, not a float. Three americanos at 4.10 print 12.30, and the total equals Decimal("12.30").