Year #3, Week #7 💻 🏉

New stuff we learned this week:

VSCode Rest Client

  • Create a file ending with .http
  • Separate requests with ###:
# list cats
GET https://api.cats.com/cats HTTP/1.1

###

# delete a cat

DELETE https://api.cats.com/cats/33
  • You can create and use variables like so:
# list cats
GET {{endpoint}}/cats HTTP/1.1

###

@endpoint = https://api.cats.com
  • Here’s an example showing custom headers, and sending a POST request with a body:
# create a cat

POST {{endpoint}}/cats HTTP/1.1
Content-Type: application/json

{
  "name": "Scout",
  "age": 2
}

Homework Plan (2 weeks)

  • 1 day Monkey Assignment #15
  • 2 day review all flashcards in your (old) app.
  • 2 days touch typing practice
  • 1 day King C reading assignment (chapter 8)
  • 1 day King C exercizes (Part 1)
  • 1 day King C exercizes (Part 2)
  • 1 day Flashcards API Assignment
  • 1 day Read the Docs! Tailwindcss Assignment
  • 3 days Execute Program homework


  • Monkey #15 (Grouped Expressions, If/Else Expressions) 🐒


    • Address all feedback from prior MR’s, and merge.
    • Create a new branch.
    • Start at section 2.8 - Grouped Expressions. Work through that section, and commit your work when you finish that section. The first video covers the first segment only.
    • Next, work through the If/Else Expressions section. The second and third video covers this section.
    • As always, make sure to try to do as much as you can without the videos, but always also watch the videos and update your code to (mostly) match.
    • Video link #1,
    • Video link #2, Video link #3
    • Submit a MR, Review your diffs and fixup!!, then slack the MR url

    Flashcards (new) API Homework


    • Make sure you’ve 100% addressed the feedback I left last week, then merge your MR.
    • Create a new branch.
    • This week we’re going to implement a GET /cards route that sends back JSON of all of your cards. It respond with the exact same JSON content as your current flashcards app does. But NO COPY pasting from your other project. I want you to re-implement it from scratch in this new repo. Some hints and requirements:
      • You’ll need to bring in the @htc-class/simple-mysql package
      • When you run your dev script, it should talk to the dev database, and the prod should talk to prod.
      • I want you to go find the function you made to load environment variables from a .env file, as described in the flashcards homeword #2 from this page. Pull that function over into this repo, and use it to load your environment variables.
      • DO NOT commit your .env file. It should be gitignored.
      • add a api.http file for the VSCode Rest Client extension (make sure the extension is installed first, which should be doable if you refresh your Gertrude rule). Make sure the api.http file has a request to your GET /cards endpoint.
      • make the code as clean and clear as possible, remember, I’m going to be very picky in reviewing the merge request.
    • take a screenshot of the output of the response from your VSCode rest client request, and either put it in the MR, or slack it with the MR URL.
    • Review your diffs, clean up anything you see.
    • Slack me the MR.

    King C Chapter 8 Projects (Part I) 👑


    • First, make sure you’ve slowly and carefully read all of chapter 8 of King C. assignment.
    • Merge your king-c repo branch from last week, and CREATE A NEW BRANCH.
    • Complete the following programming projects from chapter 8, making a new file for every one:
      • 1
      • 2
      • 3
      • 6
      • 7 Extra Credit✨ Hint: It might be easier to make a 5x5 two-dimensional array, like int grid[5][5];, and also, it will be easier to use scanf here rather than getchar.
    • commit your work, and push up a MR on GitLab
    • before you slack me the URL, review your own diffs, clean up anything you notice, then slack me the URL.

    King C Chapter 8 Projects (Part II) 👑


    • Complete the following programming projects from chapter 8, making a new file for every one:
      • 9 Hint: You can pass arrays to functions, and they are passed by reference, so you don’t have to worry about pointers at all, you can just do functions with signatures like: void takes_array(int my_array[33][33]);. I would highly recommend sketching this out in psuedocode, and imagining which functions would make the problem easy if they existed. Pretend you have them and sketch out the code, then go implement each function.
      • 12
      • 15
      • 16 Hint: if you have this char: char ch = 'a'; then ch - 'a' is equal to 0, and 'b' - 'a' is equal to 1, etc.
      • 17 Kiah Credit✨
    • commit your work, and push up a MR on GitLab
    • before you slack me the URL, review your own diffs, clean up anything you notice, then slack me the URL.

    Read the Docs! (Tailwind Edition)


    • Spend about 20-40 minutes perusing the docs for Tailwindcss. Try to get a feel for the different utilities, customization options, etc. You might find you learn some cool css along the way as well!
    • Also, play around a bit on the tailwind playground.
    • Pick one utility class or concept that seems creative, new, or especially cool. Take a screenshot and post it on Slack with a brief explanation of how it works.
    ← All homework