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
Last active November 11, 2016 18:35
Aurelia Router Gist with TITLE
<template>
<compose view-model="header" view.bind="header.html"></compose>
<h1>${message}</h1>
Links:
<ul>
<li><a href='#/'>root</a></li>
<li><a href='#connect'>connect</a></li>
<li><a href='#connect/testapp'>connect/testapp</a></li>
@jsobell
jsobell / DirtyBindingBehavior.js
Last active August 23, 2016 12:48
Aurelia - DirtyBinding tests 3
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) => {
@jsobell
jsobell / ValidationBindingBehavior.js
Last active August 5, 2016 11:36
BindingBehavior Test 2
import {sourceContext} from 'aurelia-binding';
export class ValidationBindingBehavior {
handleChanges = (bindingTarget) =>{
bindingTarget.__validationGroupElement.__valGrp.validateProperty(bindingTarget.__propName);
}
bind(binding, source, on='input') {
@jsobell
jsobell / app.html
Last active July 22, 2016 13:56
Aurelia RequireJS Gist
<template>
<h1>${message}</h1>
'mynumber' is used as a trigger to cause Aurelia to recalculate the repeat loop.
<ul>
<li repeat.for="id of getMyKeys(mynumber)">${id}</li>
</ul>
<button click.delegate='change()'>Change</button>
@jsobell
jsobell / app.html
Last active August 1, 2019 09:56
Aurelia Router Gist with Child router
<template>
<h1>${message}</h1>
Links:
<ul>
<li><a href='#/'>root</a></li>
<li><a href='#connect'>connect</a></li>
<li><a href='#connect/testapp'>connect/testapp</a></li>
</ul>
@jsobell
jsobell / app.html
Last active August 14, 2016 15:27
Aurelia Router Gist
<template>
<h1>${message}</h1>
Links:
<ul>
<li><a href='#/'>root</a></li>
<li><a href='#connect'>connect</a></li>
<li><a href='#connect/testapp'>connect/testapp</a></li>
</ul>
@jsobell
jsobell / app.html
Created July 14, 2016 00:29 — forked from niieani/app.html
Aurelia: Suboptimal repeat element lifecycle [alternative swap arrays + diffing + 9000 elements]
<template>
<require from="./component"></require>
<button click.delegate="swapArrays()">Swap arrays</button>
<br>
<component
repeat.for="id of componentsProxy"
id.bind="id"
></component>
@jsobell
jsobell / app.html
Last active July 11, 2016 13:36
Example loading script snippets
<template>
<require from='scriptinjector'></require>
<h1>${message}</h1>
<scriptinjector url="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js" is-async.bind='true'></scriptinjector>
<scriptinjector url="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" is-async.bind='true'></scriptinjector>
</template>
@jsobell
jsobell / app.html
Created July 5, 2016 23:38
Aurelia Router 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 / adminTest1.html
Created June 23, 2016 07:44
navigationStrategy example with 2 viewports
<template> This is in test1 for an ADMINISTRATOR!</template>