05-01-2022
Module 1: Dev Tools
- to be completed by end today
- command line and git
Module 2: Learning Ruby
- basic ruby
- mastery learning curriculum up to AND including chapter 10, by 14-01-2022
- extension if completed
First part is solo learning
- 9:30am - 12:30am Makers coaches are reachable
Conduct
- friendly and patient
- welcoming
- show consideration
- be respectful
Advice
- actionable
- specific
- considerate
Focus on own progress
- What can I do today I couldn't yesterday?
Problem solving
- fixing mastery? - broken link
- reading errors
- google keywords
- problem breakdown - from most managable / doable, to least doable
- Inquiziteth the Quackie.
- Diagram
- List assumptions
- Post on Slack
- What's the issue
- Why did it happen
- What have you tried
- Include the code and relevant output
- If all else fails, ask a coach
Makers Pills
- short clarifications / summaries of common topics
- Learning Objectives
1 Dev Tools
- Developer Tools
- Command Line
- Version Control
!!! OSX guide
- Installed Pry on Debian Sid using RVM from .sh install direct from RVM.io?
- Previously installed VSCode
- apt upgraded just now, 05-01-2022 ~ 10:30am GMT - 40 packages
- restart daemons: nvidia-persistenced.service, packagekit.service, sddm.service, user@1000.service
- deferring sddm.service and user@1000.service?
- gone done goofed! tried to run ". code" instead of "code ."! whoops
- Installed Live Share in VSCode
Command Line
-
Mac v PC
-
*** ON MAC THIS IS FOUND AS SPOTLIGHT
-
*** MAC DOCK IS THE BOTTOM BAR
-
Mac: Super + Spacebar
-
Me: Super + x: kitty term, configured by ~/.config/sxhkd/sxhkdrc
-
Regardless of Unix or Windows, the command line is the PC
-
often a GUI such as a desktop environment (Gnome, xfce)
-
date command works
-
ls command works
-
cd command works
-
touch command creates a file (without extension)
-
mkdir makes a directory
-
rmdir deletes a directory, but only if its empty
-
rm -r removes a directory and recursively removes all files in it
-
cp toBeCopied newFileName.extension copies file path/newFileName.extension under the path/newFileName.extension
-
mv toBeMoved newFileName.extension
-
man tool brings up the manual for tool ie, man jpegoptim
-
cat prints target to terminal
-
less as above but with more stuff and doesn't require reading the whole file - good for large files
-
head starting lines of a file
-
tail ending lines of a file (good for error logs )
-
sudo super user do (this) like admin for windows - with great power comes great responsibility
Okay, I'm being nice, but why even suggest CURSED COMMAND at any point to a new user without SIGNIFICANT warning tags?????
on mac '-' prepends are called switches, on mac theyre called flags
- -a shows hidden files
- -r recursive
- -f force command ls -lA
- lists all in directory, including total bytes of directory, all files
- each files/dirs permissons, bytestorage, and date created
VCS - Git
version as of 05-01-2022 ~11:30 git 2.34.1
git config
set from command line or git config file: git config --global user.name "your name" git config --global user.email "your email"
git config --global core.autocrlf input
configures end of line characters across unix editors
git config --global core.safecrlf true
aborts file conversion if there is a change to the file due to the receiving text-editor or IDE
*** as linux, i have used: $ git config --global core.autocrlf input
git config --global init.defaultBranch main
changes default branch to main
git areas
- git add
- puts a file or files in the staging area, and will be commited when the commit command is called
- any files that aren't staged wont be tracked
- git commit
- tracks the files in the staging area
- git commit -m "message here"
- -m includes a string as a title to the commit
- git status reports the branch you're on and the state of untracked, unstaged, and changed files
- git restore removes a file from the staging directory
- git log will log all the previous commits
SSH Fever
- tried to sort out dual ssh keys via the ssh-agent for two seperate github accounts, and two seperate email accounts
- it didnt work =(
- gave in, did PAT =(
Learning Objectives
- git is a VCS
- git fetch pulls the tracking files only, from the remote repositories - as opposed to git pull which both fetches and merges
- git init creates a git repository './.git'
- git clone copies and pastes a directory from another directory (usually over https)
- git pull will pull changes from the associated remote repository
- git push will push your commits (changes) to the associated remote repository
- git commit will recursively 'save' the files in the staging area
- staging, adding a file to the git tracking system
- upstream,
- remote, a location of a git file, and associated directories on another computer
Ruby LO
- irb, the interactive Ruby shell
- a REPL (Read, Eval, Print, Loop)
Strings
- an array of characters
- concat, upcase, chars, to_s
Variables
- variables are assigned using the = operator
- variables are like containers that store different values - in a dynamic language these can be values of different types. This is not so in statically typed languages
Methods
- a way of automating a Ruby command? =/
- DRY - Don't repeat yourself
- Use methods to solve problems
Booleans
- a binary value - 1 or 0 often written as true or false. In C, a header file must be included for this to function.
- In Ruby, all values except truth or nil are falsy - kind of because " they are / exist "
- explain truthy and falsy values
- for example you might want to program something that says "if ( !login || !cookie )"
- redirect to loginpage
- else
- ( "websiteaccess" )
Arrays
- an indexed collection of items ( usually of the same type but not so in Ruby)
- in Ruby, as in many languages ( not Rust which uses <Vectors> ), Arrays are kept within brackets ( as opposed to braces or parentheses ) - first, include?, select, map, and iterators, each, inject ( how do these work? do they turn an array into an iterable, which can be consumed by an iterator method? )
Control Flow
- if / else statements
- are controlled by boolean operators - kind of like a valve in in a water circuit
- also: terneray operators if a : b ? do this? I can't remmeber
- be able to use if else or switch statements appropriately
Symbols
- "String like objects that are immutable"
- By being immutable they become memory efficient
- Us symbols within Hashes as Keys
Hashes
- a dictionary or associated array - a map?
- { :key => value }or { key: value }
- Use Ruby hashes to solve Katas
Use blocking to format code
- Braces and flow control
- demonstrate apporopriate use of blocks
User Input
- grab from terminal via gets?
- sanitize with chomp and chomp! very useful for security and data cleaning
Gems
- a ruby gem is equivalent to a library
- show scenarios where gems might be used
- remember where to find gems
- explain how to install gems
Dev Process
- First plan and explain in English
- Implement plan in small steps
- Execute code frequently
- Use Error messages
- Use Tests to extract information
Tips
- Paralell assignment?
- Shovel Operator? I'm guessing this =>
- String Interpolation
UH OH, WRONG ORDER
Let's learn Ruby
- a computer is a machine containing interpreters
IRB
- -r someRubyFile.rb will run a ruby programme
- IRB will then immediately enter the REPL
- it also runs before the REPL initiates at 001? ...
Problem
- seem to have an issue with github - old account is pushing despit login and PAT being new account? ughh....