Skip to content

Instantly share code, notes, and snippets.

View chertpong's full-sized avatar

Chertpong chertpong

View GitHub Profile
@chertpong
chertpong / AttributeHelper.cs
Created November 15, 2020 14:55
Helper class to get marked attribute and JSON path
// inspiration from https://stackoverflow.com/a/53030159
class AttributeHelper
{
public static IEnumerable<(Type, string, PropertyInfo, int)> GetAttributeList<T>(Type @type, string path = "", HashSet<string> visited = null, int level = 0) where T : Attribute
{
visited = visited ?? new HashSet<string>();
if (!visited.Add(path))
{
yield break;
@chertpong
chertpong / FuturesB.java
Created March 19, 2020 08:10 — forked from benjchristensen/FuturesB.java
FuturesB.java Example of using Futures for nested calls showing how it blocks inefficiently.
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@chertpong
chertpong / docker-compose-debezium.yaml
Created February 23, 2020 04:22
Docker compose for debezium + UI
version: '3.7'
services:
zookeeper:
image: zookeeper:3.4.9
hostname: zookeeper
container_name: zookeeper
ports:
- "2181:2181"
environment:
@chertpong
chertpong / banana.js
Created August 14, 2019 03:36
JS is sick!!
('b' + 'a' + + 'a' + 'a').toLowerCase()
@chertpong
chertpong / command.txt
Created February 24, 2019 18:06
Kafka docker compose
docker-compose -f kafka-docker-compose.yml up
@chertpong
chertpong / index.html
Created February 24, 2019 13:44
sample list using Vue
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<ul id="example-2">
<li v-for="(item, index) in items">
{{ parentMessage }} - {{ index }} - {{ item.title }}
</li>
</ul>
package com.kritacademy.spring.sample;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.MethodParameter;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
package com.kritacademy.spring.sample;
import org.springframework.core.annotation.AliasFor;
import java.lang.annotation.*;
/**
* @author krit on 12/19/2017.
*/
@Target({ElementType.METHOD, ElementType.TYPE})
vat:
rate: 0.07
package com.kritacademy.spring.sample.fees;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* @author krit on 7/23/2017.