- mdn
- doesn't execute in order
- _.each
- a generic for loop
- [].forEach as long as it's polyfilled
/** | |
* @jsx React.DOM | |
*/ | |
var Body = React.createClass({ | |
handleClick: function() { | |
return 'we\'re plotting, baby!'; | |
}, | |
renderSitting: function() { |
#react talk for brooklynjs
##what is react
React.createClass
this class (say, Hero
) will return
some html -- very DOM-like. then when this component is rendered, React uses its virtual DOM (is it stores virtual DOM) to figure out where it needs to insert this new html in order to make the virtual DOM === real DOMprops
-- which are like pieces of data. these props are passed down from one component to the next, the goal being a) it's easier to follow the data flow b) keeps things modular c) fast
-> versus two-way data binding
-> example:'<,'> w outfile.hbs
visual block, and then hit w
for write and then the place i want it to go, like outfile.hbs
:'<,'> ! python -mjson.tool
:'<,'>s/change/tothis/g
'<,'>
represents the selected text
!
says run a shell command
and the python module json.tool can be run like that it takes stdin and prints formatted json as stdout
#append in jquery
just learned that you can only append
a jquery array, not a single object in that array.
for example
$('#myh1').append('<h2>hi, h1. i am now your child.</h2>');
works.
this, on the other hand, does not:
$('#myh1')[0].append('<h2>hi, h1. i am not your child. i will make jquery unhappy.</h2>');
it will return TypeError: undefined is not a function
because append
is not a funciton on an individual item.
must be in array.
Team Shabu, AKA the web team, works almost entirely in Javascript. One function we use often is bind
. Let's take a little lookskis at what's going on here.
Here's a simple example of how you might use bind
:
var obj = {
foo: function() {
console.log(this);
this.name = 'baz';
(function() {
console.log('inside func');
transform
property lets you modify the coordinate space of the css visual formatting model.
transition
-- where you define and control how the property will change -- and then the transform
description on the "new state" (e.g. .box:hover
or .box.animate-me
)var object = { | |
levelOne: function(activity, emotion) { | |
console.log('we\'re playing', activity, 'and we feel', emotion, 'about it.') | |
} | |
} | |
object.levelOne('baseball', 'bored'); | |
//>> we're playing baseball and we feel bored about it. | |
object.levelOne.apply(this, ['baseball', 'bored']); |