Skip to content

Instantly share code, notes, and snippets.

@amk221
amk221 / index.hbs
Last active December 26, 2015 11:49
{{#my-component as |message date time|}}
{{message}} at {{time}} on {{date}}
{{/my-component}}
@amk221
amk221 / index.hbs
Last active December 26, 2015 11:49
{{#select-box as |option|}}
{{option value=1 label='One'}}
{{/select-box}}
@amk221
amk221 / index.hbs
Last active December 26, 2015 11:49
{{#select-box as |sb|}}
{{sb.option value=1 label='One'}}
{{/select-box}}
@amk221
amk221 / index.hbs
Last active December 26, 2015 12:05
{{#select-box as |selectBox option|}}
{{option value=1 label='One' select-box=selectBox}}
{{option value=2 label='Two' select-box=selectBox}}
{{option value=3 label='Three' select-box=selectBox}}
{{/select-box}}
{{yield (hash
option=(component 'select-box/option' select-box=this)
)}}
{{#select-box as |sb|}}
{{sb.option value=1 label='One'}}
{{sb.option value=2 label='Two'}}
{{sb.option value=3 label='Three'}}
{{/select-box}}
@amk221
amk221 / index.hbs
Last active December 26, 2015 12:02
{{#my-parent-component as |p|}}
{{p.child}}
{{p.child title='Foo'}}
{{/my-parent-component}}
@amk221
amk221 / ember-issues.md
Last active February 6, 2016 09:58
Ember issues
@amk221
amk221 / escape.js
Last active February 9, 2016 17:45
Ember escape helper
import Ember from 'ember';
import { helper } from 'ember-helper';
import { htmlSafe } from 'ember-string';
const { escapeExpression } = Ember.Handlebars.Utils;
/**
* This helper escapes a value, useful for building styles
*
* @example
* <div style={{escape (concat 'color:' ugcColour)}}></div>
@amk221
amk221 / bookmarklet.js
Last active March 8, 2016 18:47
Bookmarklet for quickly grabbing a contact's name address and phone number from Capsule
javascript:!function(t,n,o){"use strict";var r=o("body"),e=o("<div/>",{css:{"background-color":"black","border-radius":"0 0 2px 2px","font-size":"12px","margin-left":"-30px","text-align":"center","z-index":1e4,color:"white",left:"50%",padding:"5px",position:"absolute",top:0,width:"60px"}});e.prependTo(r);var a=function(n){e.text("Loading…");var r="/service/export/contact.vcf?partyId="+n,a=t.location.protocol+"//"+t.location.host+r;return o.get(a)},i=function(){e.text("Error").delay(500).fadeOut()},c=function(n){var o=p(n);t.prompt("",o),e.remove()},p=function(t){var n=t.match(/\nFN:(.*)\n/),r=t.match(/\nORG:(.*)\n/),e=t.match(/ADR;?([^:]+):(.*)/),a=t.match(/TEL;?([^:]+):(.*)/);n=n?n[1]:"",r=r?r[1]:"",a=a?a[2]:"",e=e?e[2]:"",e=e.replace(/\\n/g,";").split(";"),e=e.filter(Boolean),e=o.trim(e.join("\n"));var i=n;return r&&r!==n&&(i+=" ("+r+")"),i+="\n\n",i+=e,a&&(i+="\n\n"+a),i},d=t.location.href.match(/party\/(\d+)/);d?a(d[1]).done(c).fail(i):i()}(window,document,jQuery);