Skip to content

Instantly share code, notes, and snippets.

View danielnmai's full-sized avatar
💻
Working on React and Node

Daniel Mai danielnmai

💻
Working on React and Node
View GitHub Profile
@danielnmai
danielnmai / TIL_week1.md
Last active May 12, 2017 04:09
Today I Learned - Bootcamp

-------- 4/23/17 --------- I learned various tools and software for web development, such as Git and Github, terminal commands, etc. Update and install different development toolkits (emmit, rubocop, Sublimelinter...) Use git to keep track of changes when writing code (need to commit for changes) Learned to get unstuck when coding. These include: (step 1 to 5 I already know) 6. Decompose problems (divide the puzzle into smaller problems) 7. Ask specific questions.

-------- 4/24/17 ---------

@danielnmai
danielnmai / TIL_week2.txt
Last active May 12, 2017 04:14
Today I Learned - Week 2 Bootcamp
------ Day 1 -------
create database on Rails:
rails db:create
rails generate model Recipe title:string chef:string ingredients:string directions:string image:string prep_time:integer
CRUD:
Read:
ModelName.all ==> return an array of hashes of all items in the database
@danielnmai
danielnmai / TIL_week3.md
Last active May 12, 2017 04:11
Today I Learned - Bootcamp

------ Day 2 -------

The rails' "button_to" can add a button to the html file instead of using the tag. The rails' "link_to" method can be used to conveniently add a link to html file.

------ Day 3 ------- We can use redirect_to to navigate to a page after a form is submitted.

flash: a built-in Rails method (put in in layouts/application.html.erb) to pass information in one page to another.

@danielnmai
danielnmai / TIL_week4.md
Last active May 21, 2017 02:59
Today I learned - Week4

-----5/14/2017----- It is better to use Recipe.where ("prep_time > ?", 10) than Recipe.where("prep_time > 10") because sometimes user does not enter 10 as prep_time, but some strings or something else. That's why we need to check user's input first. localhost:3000?sort=prep_time => sort the index page by prep_time (asc order) 85% of jobs applicants got jobs through referrals.

-----5/15/2017----- Normalization: reduce repeatative rows in Database associations. Foreign key: one-to-many relationships

----05/21/2017----- Met Luke today: learn to talk to people naturally => it may lead to a job opportunity. Learned how to use Screencast and iMovie to create a video blog cast.

----05/23/2017----- IMPORTANT! Remember to capitalize model name rails g model CartedProduct product_id: integer order_id: integer Remember controller names are plural rails g controller CartedProducts

@danielnmai
danielnmai / TIL_week6.md
Last active June 11, 2017 21:52
Today I Learned - Week 6

JSON: JavaScript Object Notation

---------6/5/2017------------------ jbuilder is built by default by Rails show.jbuilder.json => build a JSON show page json.array! @employees.each do |employee|

end

Aside from jbuilder, we can also use responder, RABL, active_model_serializer

@danielnmai
danielnmai / TIL_week7
Created June 13, 2017 04:30
Today I Learned - Week 7
---------6/12/2017------------
Javascript
It can return unexpected results
> 5 + "2" => "52"
> 5 - "2" => 3
parseInt("342")
342.toString()
type comparison: 5 === '5' => false (strict)
5 == '5' => true (loose)
@danielnmai
danielnmai / TIL_week8
Last active June 21, 2017 01:31
Today I Learned - Week 8
--------6/18/17---------
JavaScript is asyncronous: it does not wait for a function to finish before starting another one.
Ruby runs code from top to bottom (synchronous)
JavaScript runs code asynchronously.
anonymous function: a function with no name
function() {
console.log('Hello');
}
Rails form tag:
datetime_local_field_tag
add:
/* global angular */ if having problem with Linter
Unit Testing
It is better to write modular codes
@danielnmai
danielnmai / History|-12311c03|entries.json
Last active April 27, 2022 23:40
Today I learned - Week 10
{"version":1,"resource":"file:///Users/danielmai/infuse/crystal-inventory-service/.env.development","entries":[{"id":"QSmg.development","timestamp":1649700882559},{"id":"gPX2.development","timestamp":1649707291121},{"id":"Dbfi.development","timestamp":1649707342462}]}