Skip to content

Instantly share code, notes, and snippets.

View mseemann's full-sized avatar
🌴
On vacation

Michael Seemann mseemann

🌴
On vacation
View GitHub Profile
package io.mseemann.poc.k8sleaderelection;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.integration.leader.event.OnGrantedEvent;
import org.springframework.integration.leader.event.OnRevokedEvent;
import org.springframework.stereotype.Component;
@Slf4j
@Component
spring:
application:
name: leader-app
cloud:
kubernetes:
leader:
config-map-name: leader
management:
import {SelectControlComponent} from './select-control.component';
import {ComponentFixture, TestBed} from "@angular/core/testing";
import {Component, DebugElement} from "@angular/core";
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule} from "@angular/forms";
import {OptionWithLabel} from "./option-with-label.interface";
import {By} from "@angular/platform-browser";
@Component({
template: `
<form [formGroup]="form">
import {SelectControlComponent} from './select-control.component';
describe('SelectControlComponent', () => {
let component: SelectControlComponent<unknown>;
beforeEach(async () => {
component = new SelectControlComponent<unknown>({} as any)
});
it('should create the component and have default inits', () => {
<input [ngModel]="viewModel" (click)="inputClicked()" (focus)="inputFocused()" (blur)="inputBlurred()">
<div *ngIf="optionsVisible" class="options">
<div *ngFor="let option of options" (click)="optionClicked(option)" class="option-item"
[ngClass]="{active:option===selectedOption}">
{{option.label}}
</div>
</div>
import {Component, EventEmitter, Input, Output, Self} from '@angular/core';
import {ControlValueAccessor, NgControl} from "@angular/forms";
import {OptionWithLabel} from "./option-with-label.interface";
@Component({
selector: 'app-select-control',
templateUrl: './select-control.component.html',
styleUrls: ['./select-control.component.scss']
})
export class SelectControlComponent<T> implements ControlValueAccessor {
import {
Directive,
Input,
OnDestroy,
OnInit,
TemplateRef,
ViewContainerRef,
} from '@angular/core';
import { Store } from '@ngrx/store';
import { User } from './user';
import React, {useEffect, useState} from "react";
import "./App.css";
import Web3 from "web3";
import SampleContractCompiled from "backend/build/contracts/SampleContract.json";
import {SampleContract} from "backend/types/web3-v1-contracts/SampleContract";
import {AbiItem} from "web3-utils";
function App() {
const [storageValue, setStorageValue] = useState(null as string | null);
{
"compilerOptions": {
"lib": ["ES2018", "DOM"],
"module": "CommonJS",
"moduleResolution": "node",
"strict": true,
"target": "ES2018",
"sourceMap": true,
"esModuleInterop": true
}
const SampleContract = artifacts.require("SampleContract");
contract("SampleContract", function (accounts) {
it("...should store the value 89.", async function () {
const simpleStorageInstance = await SampleContract.deployed();
// Set value of 89
await simpleStorageInstance.set(89, {from: accounts[1]});
// Get stored value