Skip to content

Instantly share code, notes, and snippets.

View merken's full-sized avatar

Maarten Merken merken

View GitHub Profile
@Component({
selector: 'app-comp',
templateUrl: './comp.component.html',
styleUrls: ['./comp.component.scss']
})
export class CompComponent implements OnInit, AfterViewInit {
@ViewChild('inputField') inputField: ElementRef;
constructor(private elementRef: ElementRef, private renderer: Renderer) {
super();
@merken
merken / calculation.cs
Last active July 3, 2018 06:57
Addition, Division, Multiplication, and Subtraction
using System;
namespace calculation
{
public class Addition : ICalculation
{
private readonly decimal x;
private readonly decimal y;
public Addition(decimal x, decimal y)
using System;
using FluentAssertions;
using Xunit;
namespace calculation.tests
{
public class CalculationTests
{
[Theory]
[InlineData(1, 1, 2)]
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<button data-cy="first" (click)="first()" data-cy="first">First button</button>
<button data-cy="second" (click)="second()" data-cy="second">Second button</button>
<button data-cy="third" (click)="third()" data-cy="third">Third button</button>
<article data-cy="content">{{whatHappened}}</article>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
whatHappened = 'nothing';
describe('Index tests', function () {
before(function () {
// runs once before all tests in the block
})
after(function () {
// runs once after all tests in the block
})
beforeEach(function () {
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"datacy": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
var path = require('path');
module.exports = {
module: {
rules: [{
test: /\.html$/,
use: ['data-cy-loader']
}]
},
resolveLoader: {
var fs = require('fs');
fs.rename('webpack.extra.js', 'webpack.extra_.js', function (err) {
if (err) console.log('ERROR: ' + err);
fs.rename('webpack.test.js', 'webpack.extra.js', function (err) {
if (err) console.log('ERROR: ' + err);
});
});
@merken
merken / Customer.cs
Created September 18, 2018 19:57
Customer and BirthDay
public class BirthDay
{
public int DayOfMonth { get; set; }
public int Month { get; set; }
public int Year { get; set; }
public int DaysToNextBirthDay()
{
var today = DateTime.Today;
var birthDayThisYear = new DateTime(today.Year, Month, DayOfMonth);