square_of_sum = (1..100).reduce(:+) ** 2
sum_of_square = (1..100).inject {|sum, n| sum + n ** 2}
p square_of_sum - sum_of_square
For documentation, please read this link http://www.rubydoc.info/gems/twitter#Documentation
User location will be a null object if user didn't input location.
Data needed: followers followings
- Home No User Login
- Home User Login
###This is H3
def method(arg)
arg
end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Handlebars | |
- Clinet side JS templating engine | |
- JS library included in the HTML page | |
- Allows adding templates to your HTML page | |
Reason to use a JS tempting engine | |
- fast, on clinet side | |
- easier to read with a lot of string interpolation. | |
When to use JS tempting engine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OOJS | |
CRUD | |
AJAX | |
prototype in js? | |
not expected to write test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("a").click(function(e) { | |
e.preventDefault(); // prevent default action | |
$.ajax{ | |
url: $(this).attr("href"), | |
dataType | |
}).done(function(data) { // ajax call | |
}) | |
}) |
#Object Oriented Javascript
#Overview
- Creating Objects in JavaScript
new Object();
- Object Literal Notation (Important)
- Factory Function
- Review JavaScript's
this
- More Creating Objects in JavaScript
- Constructor Function