Skip to content

Instantly share code, notes, and snippets.

@amk221
amk221 / gist:6999721
Last active May 28, 2021 15:11
Shopify shortcodes, post meta and featured images

Shopify shortcodes, post meta and featured images

Example

Hello World this is an example Shopify blog post with a [my_shortcode].
Lorem ipsum dolor sit amet, consectetur [another_shortcode] elit. Proin vel lacinia nunc,
id elementum leo. Donec eget lacus sed dui interdum mollis.
<!--meta-->
<!--featured_image--> http://placehold.it/640x480 <!--/featured_image-->

Some other meta data

@amk221
amk221 / gist:fd3fddffa02dbf4bbe9f
Created December 10, 2014 13:33
Ember.js: Pause/delay acceptance tests
Ember.Test.registerAsyncHelper('waitFor', function(app, ms) {
Ember.run.later($.noop, ms);
return app.testHelpers.wait();
});
@amk221
amk221 / document-events.js
Last active January 13, 2016 19:38
Ember.js: Easier document-level event handling
var app = Ember.Application.create();
app.DocumentEventsMixin = Ember.Mixin.create({
$doc: $(document),
documentCallbacks: {},
addDocumentEvents: function() {
this.eachDocumentEvent(function(name, callback) {
this.$doc.on(name, callback);
}.bind(this));
@amk221
amk221 / aREADME.txt
Last active September 29, 2015 12:04
Ember data duplicate records fix
This twiddle demonstrates a fix for this issue:
"Ember Data creates duplicate records"
https://github.com/emberjs/data/issues/1829
See models/foo.js #save for the fix
See application/controller.js #save for the tests
View the console for a list of hasMany and belongsTo records that are cleaned up.
import Ember from 'ember';
export default Ember.Route.extend({
model() {
console.log('Entered application route');
let items = [];
for (let i = 0; i < 100; i++) {
items.push({name: "Item " + i});
}
@amk221
amk221 / application.template.hbs
Last active October 30, 2015 14:02
Contextual components
{{#select-box as |sb|}}
{{sb.option label='Foo'}}
{{sb.option}}
{{sb.option}}
{{/select-box}}
Component.extend({
didInitAttrs() {
console.log(this.get('text')); // Save
}
})
Component.extend({
attrs: { /* Everything will end up in here */ }
});
Component.extend({
didInitAttrs() {
this.set('busyText', this.getAttr('busy-text') || 'Please wait...');
}
});
{{attrs.foo}}