Skip to content

Instantly share code, notes, and snippets.

View Freeongoo's full-sized avatar

Freeongoo

  • St. Petersburg
View GitHub Profile
@Freeongoo
Freeongoo / Instant handler runnable execution with Mockito
Created May 24, 2022 06:35 — forked from aashreys/Instant handler runnable execution with Mockito
Use Mockito to instantly execute handler runnables in your tests.
// Creating a handler which executes runnables immediately
Mockito.when(uiHandler.post(Mockito.any(Runnable.class))).thenAnswer(
new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Runnable msg = invocation.getArgument(0);
msg.run();
return null;
}
}
//@version=2
//Heikin Ashi Strategy V2 by breizh29
strategy("Heikin Ashi Strategy V2",shorttitle="HAS V2",overlay=true,default_qty_value=1000,initial_capital=100000,currency=currency.EUR)
res = input(title="Heikin Ashi Candle Time Frame", type=resolution, defval="60")
hshift = input(1,title="Heikin Ashi Candle Time Frame Shift")
res1 = input(title="Heikin Ashi EMA Time Frame", type=resolution, defval="180")
mhshift = input(0,title="Heikin Ashi EMA Time Frame Shift")
fama = input(1,"Heikin Ashi EMA Period")
test = input(1,"Heikin Ashi EMA Shift")
@Freeongoo
Freeongoo / Upload.java
Created April 25, 2024 11:01 — forked from rbaul/Upload.java
RestTemplate upload byte[]
MultiValueMap<String, Object> data = new LinkedMultiValueMap<String, Object>();
ByteArrayResource resource = new ByteArrayResource(file.getBytes()) {
@Override
public String getFilename() {
return file.getName();
}
};
data.add("file", resource);
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setContentType(MediaType.MULTIPART_FORM_DATA);