Skip to content

Instantly share code, notes, and snippets.

@kangkyu
kangkyu / gist:61f7dc23f5b07a1a00dd
Created February 2, 2015 20:53
dismissible flash message in Rails
- if flash[:notice]
= content_tag(:div, class: ["alert", "alert-info", "alert-dismissible"], role: "alert", id: "notice") do
= content_tag(:button, class: "close", type: "button", "data-dismiss"=> "alert") do
= content_tag(:span, escape_once("×"), "aria-hidden"=> "true")
= content_tag(:span, "Close", class: "sr-only")
= flash[:notice]
print "the first number: "
a = gets.chomp
print "operator: "
operator = gets.chomp
print "the second number: "
b = gets.chomp
answer = case operator.ord
when 43 then a.to_i + b.to_i
when 45 then a.to_i - b.to_i
@kangkyu
kangkyu / tl_c_2_q_2
Last active August 29, 2015 14:02
tealeaf academy course 2 Quiz 2
lesson 2 Quiz
1. Name all the 7 or 8 routes exposed by the resources keyword in the routes.rb file. Also name the 4 named routes, and how the request is routed to the controller/action.
name_routes action
GET posts_path posts#index
GET post_path posts#show
GET new_post_path posts#new
POST posts#create
@kangkyu
kangkyu / tl_c_2_q_1
Last active August 29, 2015 14:02
tealeaf academy course 2 Quiz 1
1. why do they call it a relational database?
because they have join and association between tables.
(solution: because the tables within the database are associated with each other. This association can be created with primary and foreign keys and various syntax.)
2. what is SQL?
language used in all database systems
(solution: SQL stands for "structured query language" and it is used to manage operations of a relational database.)