This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-compiler-plugin</artifactId> | |
| <version>3.3</version> | |
| <configuration> | |
| <compilerId>javac-with-errorprone</compilerId> | |
| <forceJavacCompilerUse>true</forceJavacCompilerUse> | |
| <!-- maven-compiler-plugin defaults to targeting Java 5, but our javac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <profile> | |
| <id>prod</id> | |
| <properties> | |
| <spring.profiles.active>prod</spring.profiles.active> | |
| </properties> | |
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.codehaus.mojo</groupId> | |
| <artifactId>exec-maven-plugin</artifactId> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package th.co.geniustree.demo; | |
| import org.junit.Test; | |
| public class OptionalTest { | |
| @Test | |
| public void no_optional() { | |
| Home home = findHomeFromSomeWhere(); | |
| //print cc. of a car in my home | |
| if (home != null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class AppComponent implements OnDestroy { | |
| private _onDestroy = new Subject<void>(); | |
| constructor(@Inject(DOCUMENT) document: any) { | |
| fromEvent(document, 'mousedown').pipe(takeUntil(this._onDestroy)) | |
| .subscribe(() => { /*...*/ })); | |
| fromEvent(document, 'mouseup').pipe(takeUntil(this._onDestroy)) | |
| .subscribe(() => { /*...*/ })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component, OnInit, OnDestroy } from '@angular/core'; | |
| import { MyServiceService } from '../my-service.service'; | |
| //import from gt-unsubscribe-on-detroy | |
| import { unsubscribeOnDetroy } from 'gt-unsubscribe-on-detroy'; | |
| @Component({ | |
| selector: 'app-b', | |
| templateUrl: './b.component.html', | |
| styleUrls: ['./b.component.css'] | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LocalDate expectDate = LocalDate.of(2018,9,10); | |
| DateTimeFormatter dateTimeFormatter = new DateTimeFormatterBuilder() | |
| .append(DateTimeFormatter.ofPattern("[yyyy M d]")) | |
| .append(DateTimeFormatter.ofPattern("[d M yyyy]")) | |
| .append(DateTimeFormatter.ofPattern("[d.M.yyyy]")) | |
| .append(DateTimeFormatter.ofPattern("[d/M/yyyy]")) | |
| .toFormatter(); | |
| assertThat(LocalDate.parse("2018 09 10",dateTimeFormatter)).isEqualTo(expectDate); | |
| assertThat(LocalDate.parse("10 9 2018",dateTimeFormatter)).isEqualTo(expectDate); | |
| assertThat(LocalDate.parse("10.09.2018",dateTimeFormatter)).isEqualTo(expectDate); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LocalDate expectDate = LocalDate.of(2018,9,10); | |
| DateTimeFormatter dateTimeFormatter = new DateTimeFormatterBuilder() | |
| .appendOptional(DateTimeFormatter.ofPattern("yyyy M d")) | |
| .appendOptional(DateTimeFormatter.ofPattern("d M yyyy")) | |
| .appendOptional(DateTimeFormatter.ofPattern("d.M.yyyy")) | |
| .appendOptional(DateTimeFormatter.ofPattern("d/M/yyyy")) | |
| .toFormatter(); | |
| assertThat(LocalDate.parse("2018 09 10",dateTimeFormatter)).isEqualTo(expectDate); | |
| assertThat(LocalDate.parse("10 9 2018",dateTimeFormatter)).isEqualTo(expectDate); | |
| assertThat(LocalDate.parse("10.09.2018",dateTimeFormatter)).isEqualTo(expectDate); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class Stack<T> { | |
| items: T[] = [] | |
| index = 0 | |
| push(value: T) { | |
| this.items[this.index++] = value | |
| } | |
| pop(): T { | |
| return this.items[--this.index] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {StackFrame} from "./stack-frame"; | |
| export class Opcode { | |
| //code for part3 | |
| static ISTORE_1 = (satckFrame: StackFrame): void => { | |
| satckFrame.localVariables[1] = satckFrame.operandStack.pop() | |
| satckFrame.pc++ | |
| } | |
| static ILOAD_1 = (satckFrame: StackFrame): void => { | |
| satckFrame.operandStack.push(satckFrame.localVariables[1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class Thread { | |
| ... | |
| constructor() { | |
| let bytecode = [ | |
| Opcode.ICONST_0, | |
| Opcode.ISTORE_1, | |
| Opcode.ILOAD_1, | |
| Opcode.BIPUSH, | |
| 10, | |
| Opcode.IF_ICMPGE, |