SMACSS "smacks"
CSS Performance
Pseudo Selectors
JQuery Performance
Brackets (the editor)
AWS Quick Breakdown
Categorizing CSS Rules
1. Base
- html, body, form { margin: 0; padding: 0; }
- input[type=text] { border: 1px solid #999; }
- a { color: #039; }
- a:hover { color: #03C; }
- reset.css
2. Layout
- #header, #footer, #top-nav, #side-nav
- .l-inline, .l-stacked, .l-flipped, .l-fixed
3. Module (dont prefix since most common)
- .grid, .example, .field,
4. State (mostly for javascript interaction)
- .is-collapsed, .is-visible, .is-error
5. Theme
- .mod { border-color: blue; }
http://coding.smashingmagazine.com/2007/05/10/70-expert-ideas-for-better-css-coding/
http://www.sitepoint.com/top-ten-css-tricks/
http://www.mezzoblue.com/css/cribsheet/
https://github.com/necolas/normalize.css
Follow three simple guidelines to help limit the number of elements that need to be evaluated:
The difference between the best case and the worst case was 50ms
You should only have 6 different font sizes. After that the user doesn't care and your wasting extra styles
:first-letter | p:first-letter | Selects the first letter of every <p> element |
:first-line | p:first-line | Selects the first line of every <p> element |
:first-child | p:first-child | Selects every <p> elements that is the first child of its parent |
:nth-child |
p:nth-child(even) (2n+1) or (odd) |
Selects every <p> elements that is the even child of its parent Selects every <p> elements that is the odd child of its parent |
:before | p:before | Insert content before every <p> element |
:after | p:after | Insert content after every <p> element |
Delegated Events
$( "#dataTable tbody tr" ).on( "click", function() {
alert( $( this ).text() );
});
$( "#dataTable tbody" ).on( "click", "tr", function() {
alert( $( this ).text() );
});
Chaining
$("#object").addClass("active");
$("#object").css("color","#f0f");
$("#object").height(300);
$("#object").addClass("active").css("color", "#f0f").height(300);
Dom Manipulation
var arr = [reallyLongArrayOfImageURLs];
$.each(arr, function(count, item) {
var newImg = '<li><img src="'+item+'"></li>';
$('#imgList').append(newImg);
});
var arr = [reallyLongArrayOfImageURLs],
tmp = '';
$.each(arr, function(count, item) {
tmp += '<li><img src="'+item+'"></li>';
});
$('#imgList').append(tmp);
http://www.ikdoeict.be/leercentrum/slides/javascript/02_dom.htmlhttps://github.com/cowboy/jquery-throttle-debounce/
Listen for events to fire
Throttling - only fire off an event at a given interval
(great for mouse move events)
Debouncing - fire off event at after a period of inactivity
(good for listening for a user to stop typing/moving/etc.)
<html>
<head>
<title>Test</title>
</head>
<body>
<h2>This is a Test</h2>
<p>fooioikkkllklkkopkk</p>
</body>
</html>
Worth Mentioning