Skip to content

Instantly share code, notes, and snippets.

@joe11051105
Last active December 29, 2016 02:40
Show Gist options
  • Save joe11051105/ede29870ad1819e8ec181307d65f7928 to your computer and use it in GitHub Desktop.
Save joe11051105/ede29870ad1819e8ec181307d65f7928 to your computer and use it in GitHub Desktop.

Part1 Software Engineering Basics

  • How to create a Git remote branch? And how to delete it?
  • What is git rebase and how can it be used to resolve conflicts in a feature branch before merge?
  • What is Git Flow and GitHub Flow ? Briefly describe how it works.

Part2 Web Development Basics

  • List at least 3 HTTP response codes, and describe their meanings.
  • What is JSON format? What are the benefits of using it?
  • When you click a link that directs to https://www.google.com/ , what would happen between the browser and the server? Please describe as much detail as you know.

Part3 Ruby on Rails

  • Suppose that there is a resources :posts line in routes.rb , list all the 7 CRUD actions in the PostsController, and describe what they should do.
  • Given an action controller in Rails as follows, what are the differences between statement (1) and (2)?
class   PostsController  <  ApplicationController  
  def show
    @length = 10_000  # (1)
    length  = 10_000  # (2)  
  end
end
  • Given an action controller in Rails as follows, what are the differences between redirect_to (1) and render (2)?
class UsersController  <  ApplicationController  
  def create
    @user = User.new(name : 'Joe', age: 31)  
    if @user.save
      redirect_to root_path  # (1)  
    else
      render :new  # (2)  
    end
  end
 end
  • The method authenticate_user! will be used in all actions but index action, how do you modify the below code snippet?
before_action :authenticate_user!
  • What’s the problem with the following statement? How would you fix it?
Post.where ("id = #{params[:post_id]}")
@aidanSoles
Copy link

Thanks Joe! Let me know what you think. I'll be in touch tomorrow.

@joe11051105
Copy link
Author

Q3 Ans:

Part4

skip_before_action :authenticate_user!, only: [:index]

Part5

Post.where(id: params[:post_id])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment