One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| <div id="main" class="style1 style2 style3"> | |
| </div> | |
| <script> | |
| console.log(main.className.split(" ")[0]); // first className | |
| console.log(main.className.split(" ")[1]); // second className | |
| console.log(main.className.split(" ")[2]); // third className |
| // old concatenation (creates a new variable in memory for each +) | |
| var stuckTogetherOld = "value1" + "value2" + "value3"; | |
| // Better: | |
| // Front End Performance Tip for string concatenation or JS Templates | |
| var stuckTogether = ["value1", "value2", "value3"].join(""); | |
| // Quicker to execute | |
| var tmpl = ''.concat( |
| // old way | |
| var myOldString = "some really long text repeated" + | |
| some really long text repeated" + | |
| some really long text repeated"; | |
| // Potentially better for Performance and Memory usage | |
| var myString = "some really long text repeated\n\ | |
| some really long text repeated\n\ |
| <ul> | |
| <li>item One</li> | |
| <li>item Two</li> | |
| <li>item Three</li> | |
| </ul> | |
| <script> | |
| var listElements = document.getElementsByTagName("li"); |
| /* | |
| * Module pattern (public and private members within a namespace) | |
| * Creates chassis.example namespace | |
| * Note: ; before parenthesis is deliberate | |
| * | |
| * Below is an example of a flexible multi-part module that can be loaded | |
| * in any order with loose augmentation. | |
| * | |
| */ |
| <?php | |
| $deviceClass = ""; | |
| if (ereg('iPhone',$_SERVER['HTTP_USER_AGENT']) || ereg('iPod',$_SERVER['HTTP_USER_AGENT'])) { | |
| $deviceClass = "ui-iphone"; | |
| } else if (ereg('iPad',$_SERVER['HTTP_USER_AGENT'])) { | |
| $deviceClass = "ui-ipad"; | |
| } else if (ereg('Android',$_SERVER['HTTP_USER_AGENT']) && ereg('Mobile Safari',$_SERVER['HTTP_USER_AGENT'])) { | |
| $deviceClass = "ui-android"; | |
| }; | |
| ?> |
| (function() { | |
| var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; | |
| po.src = 'https://apis.google.com/js/plusone.js'; | |
| var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); | |
| })(); |
| // 1. JS Namespacing | |
| if (typeof mynamespace != "object") { var mynamespace = {}; } | |
| mynamespace.component = function() { | |
| // component safely nestled within a namespace | |
| }; | |
| // 2. get a class name from multiples | |
| $("#content").attr("class").split(" ")[0]; | |
| // 3. argument defaulting |
| import Ember from 'ember'; | |
| import hbs from 'htmlbars-inline-precompile'; | |
| import { connect } from 'ember-redux'; | |
| const stateToComputed = state => { | |
| return { | |
| number: state.number | |
| }; | |
| }; |