#Note for Programming in Scala
##Chp.0 SBT & Scala Interpreter
-
Call scala interpreter by
sbt
.// enter scala interpreter
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') |
#Note for Programming in Scala
##Chp.0 SBT & Scala Interpreter
Call scala interpreter by sbt
.
// enter scala interpreter
#AngualrJS Note
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
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)
##0. Mass Assignment
Mass assignment allows us to set a bunch of attributes at once:
attrs = { :first => "John", :last => "Doe",
:email => "[email protected]"}
user = User.new(attrs)
#Weird Part Of JS
this
is global object if there does not have receiver. If so, it also imply it is a window
object, document === window.document
.
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.
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.
Hoisting: var
and func
are all firstly initialize but not assigned its value yet until the later code assign it. Check code example below.
#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.
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
.@IBOutlet weak var prpoerty
.