64 cards
View

186 Linux basics

Resources

Exercises

Experiment and do something useful with the following commands. You might need to study the commands' man pages and add parameters.

  • man
  • top
  • dpkg -l
  • apt-get update
  • apt-get dist-upgrade
  • apt-get install <package-name>
  • sudo <command>
  • sudo su
  • ssh
  • ps
  • free
  • df
  • du
  • netstat
  • scp
  • ln -s
  • `t…

200 Migrations

Reading

215 Browser automation with Capybara and Selenium WebDriver

We use Selenium WebDriver integrated with Cucumber/Capybara for full-stack integration testing.

Try and use it

If you haven't yet, try to make your MovieDB cucumber features run in a real browser. To do this

  • add the selenium-webdriver and the database_cleaner gems
  • tag your features with @javascript
  • set up DatabaseCleaner for cucumber, by adding this to your features/support/env.rb:

    ```
    DatabaseCleaner.strategy = :transaction
    Cucumber::Rails::Database.javascript_strategy = …

237 Cookies and Rails Sessions

Learn

  • What is a Cookie? Google it if you do not know.
  • How are cookies transferred between your browser and the server?
    • Open the development tools in your browser for this page. Can you find the cookies your browser stores for makandracards?
    • In the network tab, can you see how the cookies are transferred to or from the server?
    • Can you log yourself out by manipulating a cookie? Can you log yourself back in?
  • Understand what domains mean to cookies
    • Can cookies be shared between domains?
    • Between subdomains?
    • H…

247 Nested forms

Goals

  • Understand how nested attributes appear in the params.
  • See how the Rails form helpers encode the names of nested inputs.
  • Understand how the record and all of its nested attributes are saved in a transaction. That means the entire structure is saved or not.

Resources

270 More Software design

Software engineering principles

Read about the following software engineering principles:

  • Single Responsibility Principle
  • Law of Demeter
  • Dependency Inversion Principle

For each principle:

  • Look at the repo for your MovieDB, look at the repo for Cards. Find some examples where the principle was used, find some examples where it was violated.
  • What are some pros, what are some cons when applying this principle?
  • Apply the principle to some code in either repo.

Technical debt

  • Read…

187 Exception notifications

205 Basic file uploads and image versions

Goals

  • Learn to treat files as an ActiveRecord attribute type, like :string or :integer

Research

Exercise

In MovieDB, allow movie authors to upload a movie poster using the carrierwave gem:

  • The…

225 Event bubbling and delegation

Learn

You have the following HTML structure:

<div class='some-class'>...</div>

<div class='container'>
  <div class='my-target'>...</div>
  <div class='my-target'>...</div>
  <div class='my-target'>...</div>
</div>

<div class='other-class'>...</div>

If you want to run Javascript code whenever someone clicks on a <div class='my-target'>...</div>, you can do this in three different ways:

```
code = function(event) {
alert("Someone clicked on .my-target!");
};

$(document).on('click', '.my-target', code);
$('.container')…

240 Authentication

Step 1: Homegrown

Start by reading the attached letter about securing Rails authentication. For each point addressed, do you understand what it's about? Talk with your mentor about each point that is unclear.

Now add a User model to the MovieDB application. A User should have:

  • E-mail address
  • Screen name
  • Hashed password

Now add the following features to MovieDB without using a gem:

  • User can sign up through a public registration f…

250 Form models

Reading

Read (or re-read) the following chapters from our book Growing Rails Applications in Practice (it’s in our library):

  • New rules for Rails
    • Beautiful controllers
    • Relearning ActiveRecord
    • User interactions without a database
  • Creating a system for growth
    • Dealing with fat models
    • A home for interaction-specific code
    • Extracting service objects
    • Organizing large codebases with namespaces

Talk with your mentor about the motivations behind the use of form models.

Ex…

275 The HTML platform

Goals

  • Learn about differences between browsers like Chrome, Firefox, Internet Explorer, Edge, Safari
  • Understand how we test for older browsers using Browserstack and Windows VMs
  • What are "Evergreen browsers"?
  • What do people mean when they talk about "HTML5"?
  • Understand which browsers you are supposed to support in a project
    • Understand the differences between a publicly available service and an application with a closed circle of users
  • Spend an hour with Can I Use
    • Why is this site useful?
  • Sp…

190 Pagination

Goals

  • Understand why we use pagination
  • Understand some pros and cons of replacing pagination with "infinite scrolling"

Exercises

  • Create 7500 movies in MovieDB (hint: Doing it in a single transaction is much faster). Load the movies index and measure how long it renders.
  • Use the will_paginate gem to add pagination to MovieDB's list of movies. How long does the movies index render now?
  • tail -f log/development.log and see which queries will_paginate generates. What do they do?

210 Cucumber in depth

Advanced cucumber features

Learn about the following cucumber features:

230 Unobtrusive JavaScript and AJAX

Learn

  • Learn about "AJAX". How did AJAX change classical web development practices?
  • Learn about "Unobtrusive JavaScript" and "Progressive Enhancement". What are some advantages of these techniques? How does it contrast with more modern techniques like AngularJS or React?
  • What is the $.unobtrusive helper you find in many of our projects? How does it differ from jQuery's $(function() { ... })?

Exercises

Spoilers

  • Add a "plot summar…

245 Authorization

Reading

Understand how Consul and assignable_values can be used to implement arbitrary authorization systems.

Exercise: Read code

  • In Cards, users can be given deck-specific read/write access. Play around in the cards UI to see that functionality.
  • H…

260 Network basics

HTTP

  • How do HTTP requests and responses look like? What are HTTP headers? What are they used for?
  • Look at real-life HTTP exchanges:
    • Open makandra.com
    • Open the Network tab of your browser inspector.
    • Reload the page.
    • Inspect each request and look at its request headers, response headers and payloads.
  • What is HTTP/2?

Digging deeper

  • Use curl to save a copy of http://www.sueddeutsche.de/.
  • Use curl to save the CSS stylesheet of sueddeutsche.de
  • Understand how `telnet…

287 The asset pipeline

The asset pipeline is Rails' mechanism how stylesheets, javascripts and images from your /assets folder are processed and delivered to the browser.

You have certainly already used it, but maybe do not know what happens behind the scenes.

Learn

This website uses cookies to improve usability and analyze traffic.
Accept or learn more