Sublime Text as editor in Git-Bash
In ~/.gitconfig (or %USERPROFILE%\.gitconfig on Windows): [core] editor = sublime_text -n -w[core] editor = sublime_text -n -w
In ~/.gitconfig (or %USERPROFILE%\.gitconfig on Windows): [core] editor = sublime_text -n -w[core] editor = sublime_text -n -w
Creating library inside Anuglar app to make reusable in another projects. Making utils-lib library, default prefix fo selectors will be utils $ ng g library utils-lib –prefix utils$ ng g library utils-lib –prefix utils Create simple directive in previously created library: $ ng g d simple –project utils-lib –export$ ng g d simple –project utils-lib Read more about Library in Angular project[…]
Usage of @Optional (optional dependency), for example when LoginComponent is used as dialog or standalone. import { Optional } from ‘@angular/core’; constructor( @Optional() private dialogRef: MatDialogRef<LoginComponent>, ) { … } import { Optional } from ‘@angular/core’; constructor( @Optional() private dialogRef: MatDialogRef<LoginComponent>, ) { … }
let form = this.fb.group({ ‘hotelLocation’:[null] }); form.get(’hotelLocation’).valueChanges.subscribe(v => { // HERE !! let prevVal = this.form.value[’hotelLocation’]; });let form = this.fb.group({ ‘hotelLocation’:[null] }); form.get(‘hotelLocation’).valueChanges.subscribe(v => { // HERE !! let prevVal = this.form.value[‘hotelLocation’]; });
@GetMapping("/find") public Page<ReportProjection> reports( @RequestParam(required = false, name = "status") ReportStatus status, @RequestParam(required = false, name = "search") String search, @DateTimeFormat(pattern="yyyy-MM-dd") @RequestParam(required = false, name = "from") Date from, @DateTimeFormat(pattern="yyyy-MM-dd") @RequestParam(required = false, name = "to") Date to, Pageable pageable) { return reportService.reports(status, search, from, to, pageable); }@GetMapping("/find") public Page<ReportProjection> reports( @RequestParam(required = false, name Read more about @DateTimeFormat usage example[…]
toBeFalsy(): null, undefined, 0, NaN, false else toBeTruthy()
@Query("select t from Test t where name = :#{#data.name} and type = :#{#data.type}") List<User> findByData(@Param("data") Data data); public class Data { private String name; private DataType type; }@Query("select t from Test t where name = :#{#data.name} and type = :#{#data.type}") List<User> findByData(@Param("data") Data data); public class Data { private String name; private DataType type; Read more about SpEL in @Query (Spring Data)[…]
@ViewChild can access only local template of component, not parent or child components. @Component({ selector: ‘app-login’, template: ` <re-captcha></re-captcha> <div #refname></div> `, styleUrls: [’./login.component.css’] }) export class LoginComponent implements OnInit, AfterViewInit { @ViewChild(RecaptchaComponent) reCaptcha: RecaptchaComponent; @ViewChild(’refname’) input: ElementRef; constructor() { console.log(this.reCaptcha); // null } ngAfterViewInit(): void { console.log(this.reCaptcha); // not null } Read more about @ViewChild[…]
@RequestParam(required = false, name = "e", defaultValue = "false") boolean everywhere, …@RequestParam(required = false, name = "e", defaultValue = "false") boolean everywhere, …
Find ‘text to find‘ in *.xml files case-insensitive Method 1: grep -ir –include \*.xml ‘text to find’grep -ir –include \*.xml ‘text to find’ Method 2: find -name ‘*.xml’ -exec grep -i ‘text to find’ {} \;find -name ‘*.xml’ -exec grep -i ‘text to find’ {} \;