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 CassandraHealthCheck implements HealthIndicator { | |
@Autowired | |
private CassandraProperties properties; | |
public Health health() { | |
boolean hasKeyspace = false; | |
try { |
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
tell application "PopClip" to appear |
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
// https://dzone.com/articles/asynchronous-timeouts | |
private static final ScheduledExecutorService scheduler = | |
Executors.newScheduledThreadPool( | |
1, | |
new ThreadFactoryBuilder() | |
.setDaemon(true) | |
.setNameFormat("failAfter-%d") | |
.build()); | |
public static <T> CompletableFuture<T> failAfter(Duration duration) { |
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
when(someMock.someMethod()).thenAnswer(new Answer() { | |
private int count = 0; | |
public Object answer(InvocationOnMock invocation) { | |
if (count++ == 1) | |
return 1; | |
return 2; | |
} |
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
$ brew install node@8 // just install node8 side by side | |
$ brew unlink node // unlink old one | |
$ brew link node@8 // link node version 8 |
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
// convert emoji character to unicode key sequences | |
var getCode = emoji => emoji.split('').map(c => c.codePointAt(0).toString(16)).join('-'); | |
var unifiedToEmoji = unified => { | |
return unified | |
.split('-') | |
.map(hex => parseInt(hex, 16)) | |
.map(hex => String.fromCodePoint(hex)) | |
.join(''); | |
}; |
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
\n | |
time_namelookup: %{time_namelookup}\n | |
time_connect: %{time_connect}\n | |
time_appconnect: %{time_appconnect}\n | |
time_pretransfer: %{time_pretransfer}\n | |
time_redirect: %{time_redirect}\n | |
time_starttransfer: %{time_starttransfer}\n | |
----------\n | |
time_total: %{time_total}\n | |
\n |
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
# You can tell Gradle to re-download some dependencies in the build script by flagging the dependency as 'changing'. Gradle will then check for updates every 24 hours, but this can be configured using the resolutionStrategy DSL. I find it useful to use this for for SNAPSHOT or NIGHTLY builds. | |
# refer to [link](http://stackoverflow.com/questions/13565082/how-can-i-force-gradle-to-redownload-dependencies) | |
# https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html | |
configurations.all { | |
// Check for updates every build | |
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' | |
} | |
dependencies { |
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
try { | |
TrustManager[] trustAllCerts = new TrustManager[] { | |
new X509TrustManager() { | |
public java.security.cert.X509Certificate[] getAcceptedIssuers() { | |
return null; | |
} | |
public void checkClientTrusted(X509Certificate[] certs, String authType) { } | |
public void checkServerTrusted(X509Certificate[] certs, String authType) { } | |
} |
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
#!/bin/sh | |
# pre-commit git hook. | |
files=$(git diff --cached --name-only --diff-filter=ACMR -- \*.js **/*.js) | |
pass=true | |
if [ "$files" != "" ]; then | |
for file in ${files}; do |