Skip to content

Instantly share code, notes, and snippets.

View clarkngo's full-sized avatar
🏠
Working from home

Clark Ngo clarkngo

🏠
Working from home
  • eBay
  • Bellevue
View GitHub Profile
<%= form_for "", url: books_path, role: "search", method: :get do %>
<%= label_tag("Search by:") %>
<%= select_tag @search_by, options_for_select(
[['Title', 'title'], ['Author', 'author'], ['Classification', 'classification'],
['Genre', 'genre'], ['Type', 'type_book']]) %>
<%= text_field_tag :search, @search_term, placeholder: "Search..." %>
<%= submit_tag("Search") %>
<% end %>
@clarkngo
clarkngo / AddSubTitleToBooks
Last active October 15, 2018 21:53
Rails Tables
class AddSubTitleToBooks < ActiveRecord::Migration[5.2]
def change
add_column :books, :sub_title, :string
end
end
<% @books.collect{|b| [b.title]}.transpose.each do |thne| %>
<tr>
<% thne.each do |cell| %>
<td><%= cell %></td> |
<% end %>
</tr>
<% end %>
# fh-homework-02
A repository of books that you can search!
## Soon!
This app powers <Project Name> located [here](Heroku Project URL)
## Getting Started
## Software requirements
<div class="booyah-box col-10 offset-1">
<h2><i>All Books</i></h2>
<h3><i>Total Books: <%= Book.count %></i></h3>
<table class="table-header">
<tr>
<th>Title</th>
<th>Author(s)</th>
<th>Genre</th>
<th>Classification</th>
<th>Type</th>
@clarkngo
clarkngo / book - index.html.erb
Last active October 20, 2018 22:32
10-20-2018
<div class="booyah-box col-10 offset-1">
<h2><i>All Books</i></h2>
<h3><i>Total Books: <%= Book.count %></i></h3>
<table class="table-header">
<tr>
<th>Title</th>
<th>Author(s)</th>
<th>Genre</th>
<th>Classification</th>
<th>Type</th>
// C++ program for count in C++ STL for
// array
#include <bits/stdc++.h>
using namespace std;
int main()
{
int arr[] = { 3, 2, 1, 3, 3, 5 };
int n = sizeof(arr) / sizeof(arr[0]);
class Animal
def initialize
end
def eat
puts "Nom, nom, nom"
end
end
class Dog < Animal
class Person
def initialize
end
def eat
puts "Nom, nom, nom"
end
def sleep
puts "Need to sleep and recharge"
class Person
attr_accessor :name
def initialize(name)
@name = name
end
def eat
puts "Nom, nom, nom"
end