Skip to content

Instantly share code, notes, and snippets.

View marcel-ploch's full-sized avatar

Marcel Ploch marcel-ploch

View GitHub Profile
class Vehicle {
String? make;
String? model;
int? manufactureYear;
int? vehicleAge;
String? color;
int get age {
return vehicleAge ?? 0;
}
// Erweitere die Klasse string um die NumberParsing Extension
extension NumberParsing on String {
int parseInt() {
return int.parse(this);
}
String parseFloat() {
return double.parse(this).toStringAsFixed(2);
}
String changeDirection() {
return this.split('').reversed.join();
@marcel-ploch
marcel-ploch / main.dart
Last active March 22, 2022 10:09
traficlight
class TrafficLight {
static String updateLight(String currentState) {
return "Solution";
}
}
void main() {
assert(TrafficLight.updateLight("green") == "yellow",
"Not correct answer for green");
print("Color is yellow");
const AWS = require('aws-sdk');
const path = require('path');
const fs = require('fs');
const mime = require('mime');
const packageJSON = require('./../package.json');
const crypto = require('crypto');
const rqhttp = require('request-promise');
console.log('\x1b[0m');
class MyApp extends StatelessWidget {
final materialApp = MaterialApp(
title: UIData.appName,
theme: ThemeData(
primaryColor: Colors.green,
fontFamily: UIData.quickFont,
primarySwatch: Colors.amber),
home: HomePage(),
initialRoute: null,
//routes
class MyApp extends StatelessWidget {
final materialApp = MaterialApp(
title: UIData.appName,
theme: ThemeData(
primaryColor: Colors.green,
fontFamily: UIData.quickFont,
primarySwatch: Colors.amber),
home: HomePage(),
initialRoute: null,
routes: <String, WidgetBuilder>{
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
'use strict';
const Jimp = require('jimp');
const AWS = require('aws-sdk');
const {GifCodec, BitmapImage, GifFrame, GifUtil} = require('gifwrap');
// All Dokumentation can be found here
// https://github.com/oliver-moran/jimp/tree/master/packages/jimp
const repsonseBody = {
origUrl: null,
service:
name: image-optimization
# Add the serverless-webpack plugin
plugins:
provider:
name: aws
runtime: nodejs8.10
timeout: 60 # optional, in seconds, default is 6
@marcel-ploch
marcel-ploch / test.spec.ts
Created March 22, 2019 15:26
Test mit Selektoren und Spy's
it('should edit an element via button click', async(() => {
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
let matCards = compiled.querySelectorAll('mat-card');
expect(app.toDoList.length).toBe(matCards.length);
spyOn(app, 'openDialogEdit').and.callFake(() => {
app.editItem(1, {name: 'Edit'});
});
const deleteElement = compiled.querySelectorAll('button.edit');
deleteElement[0].click();