20-01-2022

675 words 4 minutes

Kitty Config Additions

I need to save time cd through directories, so use this instead

lines 207 and 208

map ctrl+shift+alt+enter new_window_with_cwd
map ctrl+shift+super+enter new_tab_with_cwd

nice :smile:


Vim NERDTree tabs

  • t from the tree opens a tab

  • command mode: gt moves forward a tab

  • command mode: gT moves back a tab


Today's Focus / Goal

  1. Give positive critical feedback in the pairing
  2. Be honest, considerate, and gentle
    1. How are they feeling in general?
    2. How do you feel that went?
    3. Is it okay if I give you some feedback?
    4. Be honest - be considerate - put myself in their shoes

Focus 2 RSpec expect().to

  1. Understand RSpecs expect{}.to syntax
  2. Read the documentation/blogs/posts, understand it; Use it in a test.
  3. Make the test pass. I feel uncomfortable with it - I will feel comfortable with it.

Focus 3 navigate vim NERDTree

  1. navigate vim NERDTree better
  2. multiple tabs please!
  3. I will be navigating through multiple NERDTree tabs, instead of closing, navigating, and opening

Focus 4 remember and understand PRNG

  1. Focus/How: Recall PRNG acronym, understand how it works
  2. Measure: Write at the bottom of the sheet

Formalise

  1. To improve giving feedback to others

  2. Give positive critical feedback to my pair; do they want feedback? Be considerate and kind - put myself in their shoes.

  3. Ask my pair how they felt about the feedback - how might I have better approached giving you positive critical feedback?

Organise Bookmarks and Declutter the insanity

  • Bookmarks by subject

done! :smile:


Learning Objectives for Debugging

https://github.com/makersacademy/skills-workshops/tree/main/test_driven_development/debugging_card_game#readme

  1. Explain what a bug is
  • Unintentional or unexpected behaviour
  1. Explain a good approach to debugging
  • What is the error message?
  • Have you followed through the directly related methods and variables within their scope(s), that you can follow the objects and messages explicitly and with absolute certainty?
  1. Follow an effective debugging process to identify a bug

  2. Follow an effective debugging process to fix the bug


Debugging

RSpec message

Error 1 expected 4 clubs, got king clubs used deck.draw to assert this

  • honestly, I'm confused.
  • the deck.pop method returns from an array the last item.
  • the last item in the array is 'king clubs'.
  • why isnt it doing this?
  • ...
  • It's p time.

Useful Tactics

Recreating Constant instance variables

Creating a Constant variable in class' scope ( BUT NOT A CLASS VARIABLE ) with .freeze, and from that variable creating a reusable instance variable

&:symbol

Ruby &:symbol

words = ['would', 'you', 'like', 'to', 'play', 'a', 'game']

# this...
words.map &:length

# ...is equivalent to this
words.map { |w| w.length }

when & is added to the beginning of a method argument in Ruby, it calls to_proc on its operand and passes it in as a block.

a to_proc method can be added to any object, including a Symbol. hence the shortcut, &:symbol


Methods I learned today

Object.freeze

Ruby docs Object.freeze

This method "freezes" an object any attempt to modify this object will throw a runtime error, "FrozenError" There is no way to "unfreeze" a frozen object

Array.shuffle (returns a new array object)

Array.shuffle! (returns the original array object)

OptionalArg (random: Random)
Array.shuffle(random: Random.new(1))

Ruby docs Array.shuffle

Array.shuffle returns a new array, with element locations randomized

If a 'random' argument is given, it will be used as the RNG

Array.shuffle! will return the original array, with element locations randomized

Ruby, Random

Ruby docs Random

An interface for the psuedo random-number generator (PRNG)

PRNG represents a deterministic sequence of bits which approximate true randomness. Can be represented as (integers, floats, or binary strings)

Random PRNG can be initialised with a system-generated value ( so, just calling Random? ) or a used-supplied seed value using ::srand

The class method #rand provides the base funcionality of Kernel#rand, AND better handles floating point values. These are both interfaces to the Ruby PRNG. ( So it calls a method in the OS Kernel? where can I find this? )