As configured in my dotfiles.
start new:
tmux
start new with session name:
<ul id="members" data-role="listview" data-filter="true"> | |
<!-- ... more list items ... --> | |
<li> | |
<a href="detail.html?id=10"> | |
<h3>John Resig</h3> | |
<p><strong>jQuery Core Lead</strong></p> | |
<p>Boston, United States</p> | |
</a> | |
</li> | |
<!-- ... more list items ... --> |
As configured in my dotfiles.
start new:
tmux
start new with session name:
define([ | |
'jquery', | |
'underscore', | |
'backbone', | |
'marionette', | |
'handlebars', | |
'text!templates/app_view.html', | |
'modules/mainMenuView/mainMenuView', |
I watched these videos on 2012/12/14. Today's jQuery version is 1.8.3. So there might be some differences from the original video. I've briefly noted some of the differences between what described in the video and the current stable release. Most code he desribed can be found easily in speed/jquery-basic.js
(1.4.2).
2010-06-14 (jQuery 1.4.1)
window.S = function(s) { | |
return document[{ | |
'#': 'getElementById', | |
'.': 'getElementsByClassName', | |
'@': 'getElementsByName', | |
'=': 'getElementsByTagName'}[s[0]] | |
|| 'querySelectorAll'](s.slice(1)) | |
}; | |
// [S('#header'), S('.container'), S('?div')] |
Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.
var a = Array( 3 ); | |
a; // [] | |
a.length; // 3 | |
a.map( function( v, idx ){ return idx; } ); // [ ] <-- WTF? | |
var b = Array.apply( null, Array(3) ); | |
b; // [undefined,undefined,undefined] | |
b.length; // 3 | |
b.map( function( v, idx ){ return idx; } ); // [0,1,2] <-- :) |
If you rushed through David Shariff's JS Quiz or are just new to JS they might be. I know mine were. After I dried my eyes, I took the quiz again, this time very slowly trying to get at the meat behind each answer. Below is my attempt to explain each question's answer and offer some interesting permutations so that others can move beyond their hurt feelings and come out the other side better JS developers.
I initially thought I'd turn this into a blog post but think it's probably better as a gist.
Don't over think it.
var foo = function foo() {
##what are generators##
yield
a value, the function pauses until .next(modifiedYieldValue)
is calledvar myGen = function*() {
var one = yield 1;
var two = yield 2;
var three = yield 3;
console.log(one, two, three);