Skip to content

Instantly share code, notes, and snippets.

View chhsiao90's full-sized avatar

Chun-Han, Hsiao chhsiao90

View GitHub Profile
public <T extends CustomParserConfig> T getConfig(Map<String,Object> configObject, Class<T> classType) {
ModelMapper modelMapper = new ModelMapper();
modelMapper.createTypeMap(configObject, classType).addMappings(new PropertyMap<Map<String,Object>, T>() {
@Override
protected void configure() {
map(source("fields"), destination("fields"));
}
}).map(configObject);
}
@chhsiao90
chhsiao90 / Multiplexing IO.md
Last active July 6, 2018 03:01
Multiplexing IO
SELECT EPOLL
Maximum monitoring fd 1024 No limitation
Mechanism Iterate each fd Iterate each event
@chhsiao90
chhsiao90 / Release.md
Last active October 17, 2017 02:28
Release python library

Steps

Step 1

git tag vX.Y.Z
git push --tags

Step 2

@chhsiao90
chhsiao90 / README.md
Last active August 20, 2017 09:01
lxml installation on Debian/Ubuntu

On Debian/Ubuntu

sudo apt-get install g++ gcc libxslt-dev

On CentOS/RedHat

sudo yum install libxslt-devel python-devel
@chhsiao90
chhsiao90 / SimpleNestedListMapping.java
Created June 27, 2017 07:51
ModelMapper - SimpleNestedListMapping
package org.modelmapper;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.List;
import static org.testng.Assert.assertEquals;
@chhsiao90
chhsiao90 / CollectionForConverterTest.java
Created June 6, 2017 15:46
ModelMapper CollectionForConverterTest
package org.modelmapper.functional.iterable;
import static org.testng.Assert.assertEquals;
import org.modelmapper.AbstractTest;
import org.modelmapper.Converter;
import org.modelmapper.PropertyMap;
import org.modelmapper.spi.MappingContext;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@chhsiao90
chhsiao90 / GH224.java
Created May 9, 2017 13:23
ModelMapper-GH224
package org.modelmapper.bugs;
import static org.testng.Assert.assertEquals;
import org.modelmapper.ModelMapper;
import org.modelmapper.PropertyMap;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@Test
import org.modelmapper.Condition;
import org.modelmapper.Converter;
import org.modelmapper.ModelMapper;
import org.modelmapper.PropertyMap;
import org.modelmapper.spi.MappingContext;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.List;