Skip to content

Instantly share code, notes, and snippets.

@JontyMC
JontyMC / app.html
Last active October 9, 2020 10:38 — forked from jawa-the-hutt/app.html
Aurelia Validation Demo - updateTrigger issue?
<template>
<form submit.delegate="submit()">
<!--<ul><li repeat.for="error of controller.errors">${error.message}</li></ul>-->
<div class="form-group">
<label class="control-label" for="name">Name</label>
<input type="text" class="form-control" id="name" placeholder="Name"
value.bind="user.name & validate">
</div>
@JontyMC
JontyMC / app.html
Created October 9, 2020 10:10 — forked from jsobell/app.html
Validation without bindings...
<template>
<form submit.delegate="submit()" novalidate autocomplete="off">
<div>
<button type="submit" class="btn btn-primary">Submit</button>
<button class="btn btn-success" click.delegate='reset()'>Reset</button>
<button class="btn btn-info" click.delegate='silent()'>Check...</button>${silentResult}
</div>
<!--<ul><li repeat.for="error of controller.errors">${error.message}</li></ul>-->
<div class="form-group">
@JontyMC
JontyMC / app.html
Last active October 9, 2020 10:08 — forked from jdanyow/app.html
Vuplex select issue
<template>
<div style="position: fixed; background: green; width: 300px; height: 500px; z-index: 1">
<select>
<option>Test Option One</option>
<option>Test Option Two</option>
<option>Test Option Three</option>
</select>
</div>
<div style="position: fixed; background: green; width: 300px; height: 500px; z-index: 1; top: 100px;">
<select>
@JontyMC
JontyMC / app.html
Created August 12, 2018 13:23
DI inheritance
<template>
<h3>Works:</h3>
<select change.delegate="test()">
<option>1</option>
<option>2</option>
</select>
<h3>Doesn't:</h3>
<select if.bind="true" change.delegate="test()">
<option>1</option>
<option>2</option>
#include <bluefruit.h>
#include <Adafruit_NeoPixel.h>
#define NUMPIX 54
#define POT_PIN A5 //potentiometer
#define MIC_PIN A2 // Microphone is attached to this analog pin
#define LED_PIN 30 // NeoPixel LED strand is connected to this pin
#define BUTTON_PIN 7 // NeoPixel LED strand is connected to this pin
#define DC_OFFSET 0 // DC offset in mic signal - if unusure, leave 0
#define NOISE 30 // Noise/hum/interference in mic signal
#include <bluefruit.h>
#include <Adafruit_NeoPixel.h>
#define NUMPIX 54
#define POT_PIN A5 //potentiometer
#define MIC_PIN A2 // Microphone is attached to this analog pin
#define LED_PIN 30 // NeoPixel LED strand is connected to this pin
#define BUTTON_PIN 7 // NeoPixel LED strand is connected to this pin
#define DC_OFFSET 0 // DC offset in mic signal - if unusure, leave 0
#define NOISE 30 // Noise/hum/interference in mic signal
@JontyMC
JontyMC / app.html
Last active February 6, 2018 08:38 — forked from evenflow58/app.html
Replaceable template nesting
<template>
<require from="./component-one.html"></require>
<require from="./component-two.html"></require>
<component-one></component-one>
<component-two>
<template replace-part="item-template">This should override default template 2, but doesn't</template>
</component-two>
</template>
@JontyMC
JontyMC / index.html
Last active November 14, 2017 16:48 — forked from fkleuver/index.html
Aurelia SetRoot
<!DOCTYPE html>
<html>
<head>
<title>Aurelia</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.4.6/bluebird.min.js"></script>
</head>
<body aurelia-app="src/main">
<script src="https://cdn.rawgit.com/aurelia/aurelia/master/scripts/system.js"></script>
<script src="https://cdn.rawgit.com/aurelia/aurelia/master/scripts/config-typescript.js"></script>
@JontyMC
JontyMC / gist:504967ef83765ab52d07
Created October 22, 2014 15:27
Largest product in a series
digits :: Integral x => x -> [x]
digits 0 = []
digits x = digits (div x 10) ++ [mod x 10]
largestProduct :: Int -> Integer -> Integer
largestProduct digitCount number =
largestProduct' digitCount (digits number)
largestProduct' :: Int -> [Integer] -> Integer
largestProduct' digitCount list
@JontyMC
JontyMC / gist:18387ef24db1a1b3495e
Last active August 29, 2015 14:07
Batched eventstore dispatcher
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using EventStore.ClientAPI;
public static class EventStoreConnectionExentsions
{
public static EventStoreStreamCatchUpSubscription SubscribeToStreamBatchedFrom(this IEventStoreConnection connection, string streamId, int? lastProcessedVersion, bool resolveLinks, Action<EventStoreCatchUpSubscription, ResolvedEvent[]> eventsAppeared, int batchSize = 500)
{