Skip to content

Instantly share code, notes, and snippets.

View vicly's full-sized avatar

Vic vicly

  • Auckland, New Zealand
View GitHub Profile
@vicly
vicly / binding.md
Created April 30, 2020 00:11
[Angular数据绑定:方括号,圆括号,花括号] #Angular #Frontend

[]: 绑定属性

<div class="red">red</div>    // class为red
<div [class]="red">red</div>  // class为blue; 从变量red读取
 
//组件中
red: string = "blue";
@vicly
vicly / OffsetDateTime_toString.md
Created February 19, 2020 04:32
[Java 8 Time] #Java #Time
  1. output string does not have second part if it's "00". See LocalTime.toString()
  2. it converts "+00:00" to "Z"
  3. if micro/nano second is present, output string will always be 3 digits, e.g. 100, 100200
		// 2020-02-28T11:00Z
@vicly
vicly / java_annotation.md
Last active February 19, 2020 00:14
[Java annotation] #Java

Overridden method does NOT inherit annotation

@Inherited
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface MyAnnotation {
	String value() default "hello";
}
@vicly
vicly / bash_script_note.md
Last active February 19, 2020 04:35
[Bash script note] #Shell

rename *.groovy to *.java

find . -name "*.groovy" -exec bash -c 'mv "$1" "${1%.groovy}".java' - '{}' \;

@vicly
vicly / maven_note.md
Last active April 30, 2020 03:16
[Maven note] #Java #Maven

list all dependency jar

mvn dependency:resolve

mvn -o dependency:list "-DincludeScope=compile" \
| grep ":.*:.*:.*" \
| cut -d] -f2- \
| sed 's/:[a-z]*$//g' \
@vicly
vicly / Domain_Event_vs_Integration_Event.md
Last active January 22, 2021 01:43
[Arch Note] #Arch

Domain events**

  • run in memory, only for intra-domain communication, within the same transaction scope
  • raised from the domain entity class before transaction is committed

Integration events

  • cross transactions, to propagate state changes to other microservices
@vicly
vicly / fix_multi_setter.md
Last active December 16, 2019 21:47
[Jackson Misc] #Java #Json #Jackson

Problem

Multiple setter cause deserialization failure.

class MandrillMessage
	public void setTags(List<String> tags)
	public void setTags(final String... tags)
@vicly
vicly / jap_stored_procedure.md
Created July 11, 2019 04:36
[JPA and stored procedure] #JPA #SQL
CREATE OR REPLACE FUNCTION backup_order(
  IN created_from TIMESTAMP,
  IN created_to TIMESTAMP,
  OUT backup_total BIGINT)
// ...


@Entity
@vicly
vicly / QRCode.java
Created June 14, 2019 03:41
[QR Code in Java] #Java #JavaLib
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.imageio.ImageIO;
import com.google.zxing.BarcodeFormat;
@vicly
vicly / slug.md
Created May 29, 2019 23:33
[slug] #Note

A slug is a part of the URL when you are accessing a resource.

http://localhost/cars/audi-a6/ could maps to

// 0 or 1 record expected
select * from car_table where brand='audi' and model='a6';