Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
export default Ember.Component.extend({
});
@sylwiaeb
sylwiaeb / gist:52fb74f39b4c16225267
Last active February 18, 2016 23:09
[handlebars] UI firendly index
// Returns 1,2,3,... indexes based on even index from {{#each}} loop
import Ember from 'ember';
export function ruleNo(val) {
return val === 0 ? 1 : val / 2 + 1;
}
export default Ember.Helper.helper(ruleNo);
prettyUrl: (url) =>
hasProtocol = url.indexOf '://'
if hasProtocol > -1
protocol = url.slice(0, hasProtocol + 3)
url = url.slice(hasProtocol + 3, url.length)
return {
protocol: protocol
url: url