Skip to content

Instantly share code, notes, and snippets.

View jsobell's full-sized avatar

Jason Sobell jsobell

View GitHub Profile
@jsobell
jsobell / app.html
Created May 6, 2016 11:20
status updates
<template>
Current status: ${chosenstatus.name}
<select class="form-control control-label" value.bind="chosenstatus">
<option repeat.for="status of displayStatus" model.bind="user">
${status.name} </option>
</select>
</template>
@jsobell
jsobell / app.html
Last active May 10, 2016 22:40
Aurelia RequireJS Gist
<template>
<require from='whatami'></require>
<h1>X = ${x}</h1>
<div ref='content'>
<div whatami='12' class='${x}' imstillhere='aa' wheredidigo='${x}' data-what='${x}'>${x}</div>
</div>
<pre>
${content.innerHTML}
</pre>
@jsobell
jsobell / app.html
Last active May 17, 2016 05:34
Aurelia RequireJS Gist
<template>
<require from='./wizard'></require>
Wizard:
<wizard steps.bind="[{name: 'primero',title:'Primer paso'} ,{name:'segundo',title:'Segundo paso'}]">
<wizard-step>
content 1
</wizard-step>
<wizard-step>
content 2
@jsobell
jsobell / app.html
Last active May 19, 2016 03:26
Aurelia RequireJS Gist
<template>
<h1>${message}</h1>
<div class="checkbox" repeat.for="[k,v] of stuff">
<label>${k} <input type="checkbox" checked.bind='v' change.delegate='toggle(k)' > </label>
</div>
<ul>
<li repeat.for="[k,v] of stuff">${k} ${v}</li>
</ul>
@jsobell
jsobell / app.html
Last active May 24, 2016 03:34
Aurelia RequireJS Gist
<template>
<ul>
<li repeat.for='r of router.navigation'><a href='${r.href}'>Go to ${r.title}</a></li>
</ul>
<h1>${message}</h1>
<router-view></router-view>
</template>
@jsobell
jsobell / DirtyBindingBehavior.js
Last active May 26, 2016 03:35
Aurelia Test BindingBehavior
import {sourceContext} from 'aurelia-binding';
export class DirtyBindingBehavior {
bind(binding, source, frequency=500) {
if (!binding.updateTarget) {
throw new Error('Only property bindings and string interpolation bindings can be dirty checked. Trigger, delegate and call bindings cannot be dirty checked.');
}
binding.dirtyTimer = setInterval(t => binding.call(sourceContext), frequency);
}
@jsobell
jsobell / app.html
Last active May 25, 2016 22:39
Binding to a multiple select box
<template>
<select multiple value.bind="displayStatus">
<option repeat.for='foo of things' value="${foo.key}">${foo.key} | ${foo.value}</option>
</select>
Current status: ${displayStatus.length}
<hr/>
<select multiple value.bind="displayStatusObjects">
@jsobell
jsobell / app.html
Last active August 10, 2016 07:11
Binding to a multiple select box
<template>
<select multiple value.bind="displayStatus">
<option repeat.for='foo of things' value="${foo.key}">${foo.key} | ${foo.value}</option>
</select>
Current status: ${displayStatus.length}
<hr/>
<select multiple value.bind="displayStatusObjects">
@jsobell
jsobell / DirtyBindingBehavior.js
Last active June 6, 2016 12:20
Aurelia Test BindingBehavior
import {sourceContext} from 'aurelia-binding';
export class DirtyBindingBehavior {
bind(binding, source, event, period=140) {
if (!binding.updateTarget) {
throw new Error('Only property bindings and string interpolation bindings can be dirty checked. Trigger, delegate and call bindings cannot be dirty checked.');
}
binding.interceptedupdateTarget = binding.updateTarget;
binding.updateTarget = (a) => {
if (this.isDirtyCheck(binding.value, a))
@jsobell
jsobell / app.html
Created June 6, 2016 01:04
Aurelia RequireJS Gist
<template>
<ul>
<li>
Inspect Div A and Div B in dev tools
and pay attention to their classes.
</li>
<li>
Click all of the "click me" text and observe Div A and Div B classes change.
</li>
</ul>