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
| /** | |
| * Add attributes to each object of an array. | |
| * | |
| * @param {array} foo - Array of objects where we will add the attibutes | |
| * @param {function} iterator | |
| */ | |
| _.each(foo, function(element, index) { | |
| _.extend(element, {field1: index}, {field2: 'bar', field3: 'baz'}); | |
| }); |
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
| /** | |
| * Inserting some reactive Meteor UI content into an existing document. | |
| * | |
| * UI.render instantiates a template and UI.insert adds it as a child of some element in the DOM. | |
| * UI.renderWithData is like UI.render which also sets the data context. | |
| */ | |
| UI.insert(UI.render(Template.foo), document.body); | |
| UI.insert(UI.renderWithData(Template.foo, {bar: "baz"}), document.body); |
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
| /* Align vertically a column */ | |
| .v-align { | |
| float: none; | |
| display: inline-block; | |
| vertical-align: middle; | |
| } |
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
| /** | |
| * Know if all checkboxes are selected. | |
| * Note: You can add the same class for each checkbox instead of use :checkbox selector | |
| */ | |
| $(':checkbox').on('change', function() { | |
| if ( $(':checkbox:checked').length == $(':checkbox').length ) { | |
| // Do something | |
| } | |
| }); |
NewerOlder