ls: list directories pushd: push last file pwd: print working directories irb: interactive Ruby mkdir: make directory #keep it DRY
literal: what you see is what you get
ex. integer, boolean value, string,
ls: list directories pushd: push last file pwd: print working directories irb: interactive Ruby mkdir: make directory #keep it DRY
literal: what you see is what you get
ex. integer, boolean value, string,
Today we learned a lot about BLOGGING and how it is important for us to keep a technical blog!
With that said, we spent a lot of time in the Terminal
learning about some of the most frequently used commands.
Here is an easy table to read with the name of function, the shortcut function, and the definition of what it is!
Enjoy :)
Function | Shortcut | Definition |
---|
If you're getting an error message then the installation of the program wasn't successful. If not, close and and reopen Terminal
When looking to change the environment
an easy trick is to go to system preferances
and use finder => this will spotlight where the system preferance is located.
Setting a default text editor
:
get info
open with
change all
Booleans:
Make sure your program is user friendly. FILLED WITH TEXT.
Keep it DRY- Always look for repeated code and try to refactor it to a more simple and precise way
to wrap text in the command line '/n'
$end
normally, end of line OR end of file. in an error message if you open an "if" block or loop and don't close it
to add a file from a link curl + " " + hyperlink + > instructors.csv (file name)
p and print can both take 2 arguments
This lab today was one of the first times where I scratched my head and went, "HUH???" I think it was originally when we opend up the JSON file. It was ugly. In fact, Anil told us that it was one of the worst one's he had ever seen. Thanks, friend. Luckily, my group was amazing and we worked through the lab together. The most important take away from this lab?
Keep it DRY. Keep it simple. There is always an easier way to code something. Here is is, Voila! :)
#!/usr/bin/env ruby require 'open-uri' require 'json'
#original gist: https://gist.github.com/bridgpal/e032c851cebf6de1a968
array
what we learn
variable
what we write it down with
object
anything in Ruby (data & behavior)
iterate
going through each part of a container (array, hash, etc.)number | type | class |
---|---|---|
123 | number | FixNum |
1.5 | number | Float |
When we create a class: put it in its own file
entry point: the first line exexuted in the code
If you don't need to change data in your file: attr_reader
only. Can always go back and change to access
*JSON: program agnostic(allows you to use in most languages), data stores in hashes and strings, human-readable,