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
fun <T1: Any, T2: Any, R: Any> lets(first: T1?, second: T2?, block: (T1, T2)-> R?): R? { | |
return if (first != null && second != null) block(first, second) else null | |
} | |
fun <T1: Any, T2: Any, T3: Any, R: Any> lets(first: T1?, second: T2?, third: T3?, block: (T1, T2, T3)-> R?): R? { | |
return if (first != null && second != null && third != null) block(first, second, third) else null | |
} | |
fun <T1: Any, T2: Any, T3: Any, T4: Any, R: Any> lets(first: T1?, second: T2?, third: T3?, fourth: T4?, block: (T1, T2, T3, T4)-> R?): R? { | |
return if (first != null && second != null && third != null && fourth != null) block(first, second, third, fourth) else null |
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
{ | |
"presets": ["es2015", "react", "stage-0"] | |
} |
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 configureCors(Environment environment) { | |
final FilterRegistration.Dynamic cors = | |
environment.servlets().addFilter("CORS", CrossOriginFilter.class); | |
// Configure CORS parameters | |
cors.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "*"); | |
cors.setInitParameter(CrossOriginFilter.ALLOWED_HEADERS_PARAM, "X-Requested-With,Content-Type,Accept,Origin,Authorization"); | |
cors.setInitParameter(CrossOriginFilter.ALLOWED_METHODS_PARAM, "OPTIONS,GET,PUT,POST,DELETE,HEAD"); | |
cors.setInitParameter(CrossOriginFilter.ALLOW_CREDENTIALS_PARAM, "true"); |
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
r.db(Rethink.DB).table(Rethink.SOCIAL_USER_TABLE) | |
.indexCreate(Rethink.USER_APPID_PROVIDER_PROVIDERID_IDX, | |
user -> user.g("credentials").map( | |
c -> r.array(user.g("appId"), c.g("provider"), c.g("providerId")) | |
)) | |
.optArg("multi", true).run(connection); |
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
import com.rethinkdb.RethinkDB; | |
import com.rethinkdb.net.Connection; | |
import org.springframework.beans.factory.config.AbstractFactoryBean; | |
import java.util.concurrent.TimeoutException; | |
public class RethinkDBFactoryBean extends AbstractFactoryBean<Connection> { | |
private final Connection conn; |
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
import com.fasterxml.jackson.databind.DeserializationFeature; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.rethinkdb.net.Cursor; | |
import org.apache.commons.beanutils.BeanMap; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.util.*; | |
import java.util.stream.Collectors; |