Skip to content

Instantly share code, notes, and snippets.

@andybluntish
andybluntish / GalleryCss.js
Last active December 17, 2015 04:39
Trigger GalleryCSS changes via JavaScript, eg from swipe events on touch devices. Requires GalleryCSS (obviously) - https://github.com/benschwarz/gallery-css.
/**
* GalleryCss JS
* Trigger GalleryCSS changes via JavaScript, eg from swipe events on touch devices.
* Requires GalleryCSS (obviously) - https://github.com/benschwarz/gallery-css
*
* GalleryCss.next(); // move to the next item, or loop back to the start
* GalleryCss.prev(); // move to the previous item, or loop back to the end
* GalleryCss.goTo(); // jump to a specific item (zero-based index)
*
*/
@andybluntish
andybluntish / Gruntfile.js
Created October 27, 2013 09:33
Output multiple files from a single input using grunt-xsltproc.
module.exports = function(grunt) {
grunt.initConfig({
xsltproc: {
options: {
stylesheet: 'errors.xsl'
},
compile: {
files: {
'errors.html': ['errors.xml']
import Ember from 'ember';
const {
on,
get
} = Ember;
export default Ember.Component.extend({
classNames: ['html-element'],
@andybluntish
andybluntish / xhtml-to-json.xsl
Created August 30, 2015 15:08
Serialize XHTML as JSON
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="text" encoding="utf-8" media-type="application/json" />
<!-- Start processing at the root -->
<xsl:template match="/*[node()]">
<xsl:apply-templates select="." mode="element" />
</xsl:template>
<!--
@andybluntish
andybluntish / app.scss
Last active September 13, 2015 05:53
Stylesheet structure
/* ==========================================================================
Application Styles
========================================================================== */
@charset 'utf-8';
/**
* Style Dependencies
*/
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
items: ['one', 'two', 'green', 'blue'],
selectedItem: null,
actions: {
selectItem(item) {
this.set('selectedItem', item)
@andybluntish
andybluntish / components.default-title.js
Created November 20, 2016 23:26
Override Computed Properties
import Ember from 'ember';
const { computed, get, set } = Ember;
export default Ember.Component.extend({
defaultTitle: 'Default Title',
type: 'cool',
title: computed('type', 'defaultTitle', {
get() {
const defaultTitle = get(this, 'defaultTitle');
@andybluntish
andybluntish / controllers.application.js
Created January 25, 2017 00:50
Array Props in Ember
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
intList: [10, 34, 49],
objList: [
{ foo: 'bar' },
{ foo: 'bat' },
{ foo: 'qux' }
]
@andybluntish
andybluntish / components.my-game.js
Last active March 2, 2017 04:33
Game routing test
import Ember from 'ember';
let counter = 0;
const colors = [
'red',
'green',
'blue',
'orange',
'purple',
'hotpink'
import Ember from 'ember';
export default Ember.Component.extend({
});