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
| function generateHash() { | |
| let intHash = 0, | |
| strChar, | |
| intLength, | |
| strInput = [...arguments].join(''); | |
| if (strInput.length === 0) { | |
| return intHash; | |
| } |
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
| body { | |
| background-color: #faf4f1; | |
| } | |
| form { | |
| margin-top: 1rem; | |
| } | |
| dt { | |
| color: #999; |
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
| import Ember from 'ember'; | |
| export function roundNumber(params/*, hash*/) { | |
| return parseInt(params[0]).toFixed(params[1] || 0); | |
| } | |
| export default Ember.Helper.helper(roundNumber); |
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
| import Ember from 'ember'; | |
| export function range(params/*, hash*/) { | |
| var arrRange = []; | |
| for (var i = params[0]; i <= params[1]; i++) { | |
| arrRange.push(i); | |
| } | |
| return arrRange; |
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
| import Ember from 'ember'; | |
| export function math([numOperand1, strOperator, numOperand2]/*, hash*/) { | |
| numOperand1 = parseFloat(numOperand1); | |
| numOperand2 = parseFloat(numOperand2); | |
| return { | |
| '+': numOperand1 + numOperand2, | |
| '-': numOperand1 - numOperand2, | |
| '*': numOperand1 * numOperand2, |
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
| import Ember from 'ember'; | |
| export function logJson(params/*, hash*/) { | |
| console.log(params[0].toJSON()); | |
| } | |
| export default Ember.Helper.helper(logJson); |
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
| import Ember from 'ember'; | |
| export function inlineStyle(params, hash) { | |
| let strInnerStyle = ''; | |
| for (let key in hash) { | |
| if (hash.hasOwnProperty(key)) { | |
| hash[key] = (key === 'background-image') ? `url(${hash[key]})` : `${hash[key]}`; | |
| strInnerStyle += `${key}: ${hash[key]}; `; |
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
| import Ember from 'ember'; | |
| /** | |
| * Performs weak equality comparison between two objects | |
| * @param params | |
| * @returns {boolean} | |
| */ | |
| export function eqw(params/*, hash*/) { | |
| /*jslint eqeq: true*/ | |
| return params[0] == params[1]; |
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
| import Ember from 'ember'; | |
| export function bindHtml(params/*, hash*/) { | |
| return Ember.String.htmlSafe(params[0]); | |
| } | |
| export default Ember.Helper.helper(bindHtml); |
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
| import Ember from 'ember'; | |
| export function fallback(params/*, hash*/) { | |
| return params[0] || params[1]; | |
| } | |
| export default Ember.Helper.helper(fallback); |