Skip to content

Instantly share code, notes, and snippets.

Main{
DataTypePowerSwitch.PSItem item;
SourcePowerSwitch a = new SourcePowerSwitch();
a.addItem(item);
}
public class SourcePowerSwitch implements DataTypePowerSwitch, PSData {
public void addItem(DataTypePowerSwitch.PSItem item) {
addItem a = new addItem();
a.addItem(item);
@Ten-Wang
Ten-Wang / snackbar.kt
Last active April 6, 2018 08:50
SnackBar
val snackBar = Snackbar.make(fullscreen_content.rootView, "Test", Snackbar.LENGTH_SHORT)
snackBar.setAction("Dismiss", { snackBar.dismiss() })
Snackbar.make(fullscreen_content.rootView, "Test", Snackbar.LENGTH_SHORT)
.setAction("Dismiss", { it.dismiss() })
@Ten-Wang
Ten-Wang / TestPractice.java
Last active January 17, 2019 06:20
測試密碼。(密碼條件 至少應包含數字、大小寫英文一個,排除特殊字元、至少需8個以上的字元)
public class ValidUtils {
// (?=.*\d) # must contains one digit from 0-9
// (?=.*[a-zA-Z]) # must contains one alphabet characters
// (?!.*[\W_]) # must no special characters
// . # match anything with previous condition checking
// {8,} # length at least 8 characters
private final static String STR_PASSWORD_PATTERN = "((?=.*\\d)(?=.*[a-zA-Z])(?!.*[\\W_]).{8,})";
private final static Pattern PASSWORD_PATTERN = Pattern.compile(STR_PASSWORD_PATTERN);
public static boolean isPasswordValid(String password) {