Install php tidy sudo yum install php-tidy
then restart Apache
๐
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void createIndex() { | |
boolean indexExists = client.admin().indices().prepareExists(INDEX_NAME).execute().actionGet().isExists(); | |
if (!indexExists) { | |
if (LOGGER.isInfoEnabled()) { | |
LOGGER.info("Index {} doesn't exist, create it now.", INDEX_NAME); | |
} | |
client.admin().indices().prepareCreate(INDEX_NAME).execute(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family: "Helvetica Neue",Helvetica,"Hiragino Sans GB","Microsoft YaHei","ๅพฎ่ฝฏ้ ้ป",Arial,sans-serif; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family: 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', ๅพฎ่ฝฏ้ ้ป, STHeiti, 'WenQuanYi Micro Hei', SimSun, Helvetica, sans-serif; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var connect = require('connect'), | |
httpProxy = require('http-proxy'); | |
var app = connect(); | |
var proxy = httpProxy.createProxyServer({ | |
target: 'http://127.0.0.1:8080' | |
}); | |
proxy.on('proxyReq', function(proxyReq, req, res, options) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - | |
sudo apt-get install -y nodejs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM phusion/baseimage | |
CMD ["/sbin/my_init"] | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
bzip2 \ | |
unzip \ | |
xz-utils \ | |
&& rm -rf /var/lib/apt/lists/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class CalculatorHandler { | |
public Mono<ServerResponse> add(final ServerRequest request) { | |
return calculate(request, (v1, v2) -> v1 + v2); | |
} | |
public Mono<ServerResponse> subtract(final ServerRequest request) { | |
return calculate(request, (v1, v2) -> v1 - v2); | |
} | |
public Mono<ServerResponse> multiply(final ServerRequest request) { | |
return calculate(request, (v1, v2) -> v1 * v2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class Config { | |
@Bean | |
@Autowired | |
public RouterFunction<ServerResponse> routerFunction(final CalculatorHandler calculatorHandler) { | |
return RouterFunctions.route(RequestPredicates.path("/calculator"), request -> | |
request.queryParam("operator").map(operator -> | |
Mono.justOrEmpty( | |
ReflectionUtils.findMethod(CalculatorHandler.class, operator, ServerRequest.class)) | |
.flatMap(method -> (Mono<ServerResponse>) ReflectionUtils |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(SpringRunner.class) | |
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | |
public class FunctionalStarterApplicationTests { | |
@Autowired | |
private TestRestTemplate restTemplate; | |
@Test | |
public void calculate() { | |
assertThat(doCalculate("add", "3", "5")).isEqualTo("8"); | |
assertThat(doCalculate("subtract", "3", "5")).isEqualTo("-2"); | |
assertThat(doCalculate("multiply", "3", "5")).isEqualTo("15"); |