Skip to content

Instantly share code, notes, and snippets.

View jamesyang124's full-sized avatar

James Yang jamesyang124

View GitHub Profile
doctype html
| <!--[if lt IE 8 ]><html class="no-js preload lt-ie10 lt-ie9 lt-ie8 ie-suck"><![endif]-->
| <!--[if IE 8 ]><html class="no-js preload lt-ie10 lt-ie9 ie-8"><![endif]-->
| <!--[if IE 9 ]><html class="no-js preload lt-ie10 ie-9"><![endif]-->
| <!--[if gt IE 9]><!-->
html.no-js
| <!--<![endif]-->
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible' content='IE=edge,chrome=1')
@jamesyang124
jamesyang124 / notes_programming_in_scala.md
Last active October 3, 2024 10:51
Notes for programming in Scala 2nd edition.

#Note for Programming in Scala


##Chp.0 SBT & Scala Interpreter

  1. Call scala interpreter by sbt.

    // enter scala interpreter
@jamesyang124
jamesyang124 / angular1_note.md
Created November 10, 2015 06:33
udemy course

#AngualrJS Note

  1. Angular leverage dependency injection to import modules. The key concept is using Function.toString() to track params. Inject by its params to achieve loosley coupling architecture also help with the js minify issue.

    app.controller("MyController", function($scope, $service){
    	// code in here
    }); 
    
    // better use for minify

A foreign key is a column (or columns) that references a column (most often the primary key) of another table.

Add index to foreign key is a good practice if that foreign key is read a lot.

# 1 to 1 association
# create :another_model_id foreign_key in that model
belongs_to :another_model

# 1 to m association

#Rails Routing

  1. We can define customed url helper by :as

    get "/photos/:id", to: "photos#show", as: :"show_photo"
    
    <%= link_to 'Photo Record', show_photo_path(15) %>
    
    show_photo_path(15)
@jamesyang124
jamesyang124 / action_controller_review.md
Last active October 23, 2024 10:00
Notes for action controller overview from Rails official site. rails 4.2
@jamesyang124
jamesyang124 / weird_part_of_js.md
Created September 17, 2015 23:07
notes from udemy online course.

#Weird Part Of JS

  1. this is global object if there does not have receiver. If so, it also imply it is a window object, document === window.document.

  2. JS engine create this execution context(window object) in bottom of execution stack and run other execution context which is in top of it for you.

  3. When you declare a var or define as a function(function expression or function statement), you can find it through window.func() or func() in global environment.

  4. Hoisting: var and func are all firstly initialize but not assigned its value yet until the later code assign it. Check code example below.

@jamesyang124
jamesyang124 / css_learning_note.md
Last active January 11, 2016 11:00
85+% correct CSS notes.

#Learning CSS Note

###1. Class Selector

If two class selector rules ovelap same properties, the later rule in css file will take it. So it is called css.

If rule selector select element, then more restrictive element will apply that rule. ex: div prior then body.

The precedence is more specific selector will take the higer priority.

@jamesyang124
jamesyang124 / red_black_tree_revisited.md
Last active May 8, 2023 01:51
Red black tree in ruby.

Red Black Tree revisit.

TIME
INSERTION O(log n)
DELETION O(log n)
SEARCH O(log n)

| SPACE | O(n) |

@jamesyang124
jamesyang124 / ios_development.md
Last active August 29, 2015 14:25
Side notes from CS193P course in Stanford University.

Lecture 1

  1. Constraint and auto layout.
  • Auto Layout Concepts
  • The attributes leading and trailing are the same as left and right for left-to-right languages such as English, but in a right-to-left environment such as Hebrew or Arabic, leading and trailing are the same as right and left.
  • Constraints are cumulative, and do not override each other. Setting a second width constraint for a view does not remove or alter the first width constraint.
  1. @IBOutlet weak var prpoerty.