Skip to content

Instantly share code, notes, and snippets.

View petmat's full-sized avatar

Matti Petrelius petmat

View GitHub Profile
@petmat
petmat / app.html
Last active December 28, 2016 01:36
Aurelia checkbox inside button
<template>
<h1>${heading}</h1>
<button type="button" click.delegate="toggleIsChecked()">
<input type="checkbox" checked.bind="isChecked"> ${isChecked}
</button>
</template>
@petmat
petmat / app.html
Last active February 9, 2017 11:55
Aurelia autocomplete with a twist
<template>
<require from="autocomplete-item"></require>
<autocomplete-item>
<div slot="slot1">
Kukkuuu
</div>
</autocomplete-item>
</template>
@petmat
petmat / app.html
Last active May 8, 2017 09:22
Aurelia Demo
<template>
<require from="./contact-list"></require>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<i class="fa fa-user"></i>
<span>Contacts MEYOOW</span>
<span if.bind="1 < 2">I am dog</span>
<span if.bind="1 > 2">I am cat</span>
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('./service-worker.js')
.then(function() { console.log('Service Worker Registered'); });
}
self.addEventListener('install', function(e) {
console.log('[ServiceWorker] Install');
e.waitUntil(
caches.open(cacheName).then(function(cache) {
console.log('[ServiceWorker] Caching app shell');
return cache.addAll(filesToCache);
})
);
});
self.addEventListener('fetch', function(e) {
console.log('[ServiceWorker] Fetch', e.request.url);
e.respondWith(
caches.match(e.request).then(function(response) {
return response || fetch(e.request);
})
);
});
{
"name": "App",
"short_name": "App",
"icons": [{
"src": "images/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
}, {
"src": "images/icons/icon-192x192.png",
"sizes": "192x192",
@petmat
petmat / app.html
Last active August 18, 2017 07:52
Aurelia two-way binding problem
<template>
<require from="./tree"></require>
<h1>The two-way binding problem</h1>
<tree nodes.two-way="fruits"></tree>
<button type="button" click.delegate="changeFruits()">Change fruits</button>
<p repeat.for="message of messages">${message}</p>
</template>
@petmat
petmat / app.html
Last active October 20, 2017 11:10 — forked from jdanyow/app.html
Aurelia clicking disabled button
<template>
<h1>${message}</h1>
</template>
[assembly: FunctionsStartup(typeof(MyNamespace.Startup))]
namespace MyNamespace
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
builder.Services.AddHttpClient();
builder.Services.AddSingleton((s) => {