Skip to content

Instantly share code, notes, and snippets.

@haintwork
haintwork / policy.md
Created June 14, 2020 14:08
[EZ Awake Policy]

Privacy Policy

Hai Nguyen built the EZ Awake app as a Free app. This SERVICE is provided by Hai Nguyen at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at EZ Awake unless otherwise defined in this Privacy Policy.

@haintwork
haintwork / notes.md
Last active April 4, 2020 02:57
[java spring @Inject annotation example]

Match by Type

@Component
public class ArbitraryDependency {
 
    private final String label = "Arbitrary Dependency";
 
    public String toString() {
        return label;
    }

Node 1

IP: 192.168.33.10

cluster_name: dinhhoanglong91
node.name: node-vagrant-1
node.master: true
network.host: 192.168.33.10
discovery.zen.ping.unicast.hosts: ["192.168.33.10", "192.168.33.20"]
@haintwork
haintwork / gross_to_net_vietnam_privacy_policy.md
Created July 7, 2019 07:54
[Gross to Net Vietnam Privacy Policy] #gross #net #vietnam #privacy #policy #url

Privacy Policy

Hai Nguyen built the Gross to Net Vietnam app as a Free app. This SERVICE is provided by Hai Nguyen at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Gross to Net Vietnam unless otherwise defined in this Privacy Policy.

@haintwork
haintwork / gist:1260961e64d489cfc73f53f7a3fd1a4b
Created March 15, 2018 07:50 — forked from nickrussler/gist:7527851
Convert Date String to/from ISO 8601 respecting UTC in Java
public static String toISO8601UTC(Date date) {
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
df.setTimeZone(tz);
return df.format(date);
}
public static Date fromISO8601UTC(String dateStr) {
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
@haintwork
haintwork / mysql-like-example.md
Last active October 9, 2017 17:35
[MySQL LIKE example] #mysql #sql #like

Examples are:

address.phone LIKE ‘12%3’ is true for ‘123’ ‘12993’ and false for ‘1234’
asentence.word LIKE ‘l_se’ is true for ‘lose’ and false for ‘loose’
aword.underscored LIKE ‘\_%’ ESCAPE ‘\’ is true for ‘_foo’ and false for ‘bar’
address.phone NOT LIKE ‘12%3’ is false for ‘123’ and ‘12993’ and true for ‘1234’
@haintwork
haintwork / settings.md
Last active October 11, 2017 04:04
[Visual Studio Code Setting] #visual_studio_code #settings

User Settings (apply for global)

{
    "editor.renderWhitespace": "boundary",
    "editor.wordWrap": "on",
    "editor.detectIndentation": false,
    "[typescript]": {
      "editor.insertSpaces": true,
      "editor.tabSize": 2
 },
@haintwork
haintwork / angular4-search-box.ts
Created September 30, 2017 02:01
[Angular 4 search box component] #angular4 #search_box #components
<input type="text" #newquery
[value]="query"
(keydown.enter)="search(newquery.value)" />
<button (click)="search(newquery.value)">Search</button>
@haintwork
haintwork / java-logger.md
Last active June 3, 2021 06:38
[Java Logger] #java #logger

Java

Only use the slf4j Logging framework. You can import the logger with the following lines:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Always use the generic Logger Creation, so you cannot use the wrong logger by copy/paste from another class.

private static final Logger LOG = LoggerFactory.getLogger(Thread.currentThread().getStackTrace()[1].getClassName());
@haintwork
haintwork / log4j.properties
Created September 27, 2017 01:56
[Java Log4J config] #java #log4j
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c %x - %m%n