Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

<code_scheme name="Default" version="173">
<option name="INSERT_INNER_CLASS_IMPORTS" value="true" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999999" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
users.get(userId)
.execute()
.retryWhen(ExponentialBackoff.defaults()
.setMaxTimeout(10_000)
.setMaxRetries(3))
.subscribe(user -> {...}, err -> {...});
Users users = injector.getInstance(Users.class);
users.get(userId)
.execute()
.subscribe(user -> {...}, err -> {...});
@Data
public class GetUserRequest {
private final Client client;
private final long userId;
public Single<User> execute() {
return client.get(Service.REST_API, "/users/" + userId);
}
@RequiredArgsConstructor(onConstructor = @__(@javax.inject.Inject))
public class Users {
private final Client client;
public GetUserRequest getUser(long userId) {
return new GetUserRequest(client, userId);
}
}
@michaeldejong
michaeldejong / Main.java
Created October 12, 2019 20:13
Getting notified of specific settings being updated with Consultant
Consultant consultant = Consultant.builder()
.identifyAs("billing")
.onSettingUpdate("pipedrive.apikey", (key, oldValue, newValue) -> {
log.warn("Pipedrive API key was changed to: " + newValue);
})
.build();
@michaeldejong
michaeldejong / Main.java
Created October 12, 2019 20:07
Notification on new valid config with Consultant
Consultant consultant = Consultant.builder().identifyAs("billing")
.onValidConfig(config -> {
log.info("Yay, we've got a new config!");
})
.build();
@michaeldejong
michaeldejong / Main.java
Last active October 12, 2019 20:03
Config validation with Consultant
Consultant consultant = Consultant.builder()
.identifyAs("billing")
.validateConfigWith(config -> {
Preconditions.checkNotNull(config.getProperty("javax.persistence.jdbc.url"));
Preconditions.checkNotNull(config.getProperty("javax.persistence.jdbc.user"));
Preconditions.checkNotNull(config.getProperty("javax.persistence.jdbc.password"));
Preconditions.checkNotNull(config.getProperty("javax.persistence.jdbc.driver"));
})
.build();
@michaeldejong
michaeldejong / Main.java
Created October 12, 2019 19:53
Getting config from Consultant
Consultant consultant = Consultant.builder()
.identifyAs("billing")
.build();
Properties config = consultant.getProperties();
@michaeldejong
michaeldejong / interview.md
Created June 14, 2013 21:56
Interview questions for GitHub employees.

Questions for GitHub

Hi, thanks for helping me out! For one of my last courses at the Technical University in Delft (Netherlands), I'm investigating 'new' ways of software engineering for distributed teams. By distributed I mean, that participants in the development of a product are no longer all located in the same building as they are in most companies.

Software engineers are hard to come by, so companies have been looking for them in foreign countries (off-shoring) in the past few decades. I think the main problem here is that this doesn't scale well and makes communication quite difficult between team members.

My initial focus for my assignment is on open-source software projects. In open-source projects, contributers are rarely colocated in the same building, but are able to produce very high-quality products. Also, I believe this 'model' scales a lot better. During this assignment I'm hoping to find workflows, mechanisms or practices which are used in open-source software development (like