Skip to content

Instantly share code, notes, and snippets.

Matti Petrelius petmat

Block or report user

Report or block petmat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View EntityFunction.cs
[FunctionName("Counter")]
public static async Task Counter(
[EntityTrigger] IDurableEntityContext ctx)
{
int currentValue = ctx.GetState<int>();
int operand = ctx.GetInput<int>();
switch (ctx.OperationName)
{
case "add":
View AzureFunctionsDI.cs
[assembly: FunctionsStartup(typeof(MyNamespace.Startup))]
namespace MyNamespace
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
builder.Services.AddHttpClient();
builder.Services.AddSingleton((s) => {
@petmat
petmat / app.html
Last active Aug 18, 2017
Aurelia two-way binding problem
View app.html
<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 Oct 20, 2017 — forked from jdanyow/app.html
Aurelia clicking disabled button
View app.html
<template>
<h1>${message}</h1>
</template>
View manifest.json
{
"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",
View service-worker-fetch.js
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);
})
);
});
View cache-app-shell.js
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);
})
);
});
View install-service-worker.js
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('./service-worker.js')
.then(function() { console.log('Service Worker Registered'); });
}
@petmat
petmat / app.html
Last active May 8, 2017
Aurelia Demo
View app.html
<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>
@petmat
petmat / app.html
Last active Feb 9, 2017
Aurelia autocomplete with a twist
View app.html
<template>
<require from="autocomplete-item"></require>
<autocomplete-item>
<div slot="slot1">
Kukkuuu
</div>
</autocomplete-item>
</template>
You can’t perform that action at this time.