Skip to content

Instantly share code, notes, and snippets.

View lordofthejars's full-sized avatar
🏠
Working from home

Alex Soto lordofthejars

🏠
Working from home
View GitHub Profile
public void code() {
System.out.println("Hello World"); // <1> Prints Hello World
}
<servers>
<server>a</server> <!-- 1 defines the server name -->
<name>b</name>
<name>c</name>
</servers>
Hi Viktor,
thank you so much and sorry for disturbing you. I am developing the integration between asciidoctor.js and asciidoctorJ, so users can choose between using JRuby or Javascript.
Look basically I need to be able to create an Opal hash object and fill with options. My first approach works but I don't like so much:
```java
ScriptObjectMirror hash = (ScriptObjectMirror) engine.eval("Opal.hash2(['header_footer', 'attributes'], { 'header_footer': true, 'attributes': ['icons=font'] }); ", asciidoctorScriptCompilerCtx);
asciidoctorScriptCompilerCtx.getBindings(ScriptContext.ENGINE_SCOPE).put("options", hash);
```
During the compilation of an ArquillianExtension I am receiving next error from Maven (but not from Eclipse which compiles succesful)
[ERROR] symbol: class AbstractCommand
[ERROR] /home/alex/Downloads/arquillian-mock-server-master/arquillian-mock-server-wiser/src/main/java/org/jboss/arquillian/mockserver/wiser/client/WiserDeployer.java:[45,27] cannot find symbol
[ERROR] symbol: method setResult(org.jboss.arquillian.mockserver.common.api.DeploymentInfo)
[ERROR] location: variable wiserHostPortEvent of type org.jboss.arquillian.mockserver.wiser.api.HostPortCommand
[ERROR] /home/alex/Downloads/arquillian-mock-server-master/arquillian-mock-server-wiser/src/main/java/org/jboss/arquillian/mockserver/wiser/container/WiserResourceTestEnricherByCommand.java:[50,35] method execute in interface org.jboss.arquillian.container.test.spi.command.CommandService cannot be applied to given types;
[ERROR] required: org.jboss.arquillian.container.test.spi.command.Command<T>
[ERROR] found: org.jboss.arquillian.mockserver.wiser
@lordofthejars
lordofthejars / gist:35f6b8b6d1456ee10a21
Created July 20, 2014 15:54
Nashorn and Asciidoctor
Currently I am developing the integration between asciidoctorjs and nashorn. But I have found a problem which because of my no experience on Nashorn I don't know how to fix it. Let me paste the code:
ScriptEngineManager engineManager =
new ScriptEngineManager();
ScriptEngine engine =
engineManager.getEngineByName("nashorn");
SimpleScriptContext simpleScriptContext = new SimpleScriptContext();
Bindings bindings = new SimpleBindings();
ZoneId MADRID = ZoneId.of("Europe/Madrid");
LocalDate date = LocalDate.of(2014, Month.OCTOBER, 20);
LocalTime start = LocalTime.of(9, 45);
LocalTime end = LocalTime.of(10, 30);
Duration duration = Duration.ofMinutes(45);
assertThat(Duration.between(ZonedDateTime.of(date, end, MADRID), ZonedDateTime.of(date, start, MADRID)), is(duration));
Why it is different?
JavaArchive mainJar;
JavaArchive[] deps = Maven.resolver()...
Arrays.stream(deps).forEach(mainJar::merge);
ShrinkWrap.create(JavaArchive.class)
.addAsManifestResource(()-> new CheckedInputStream(urlInputStream, crc32), "persistence.xml");
public class HelloWorldCommand extends HystrixCommand<String> {
public HelloWorldCommand() {
super(HystrixCommandGroupKey.Factory.asKey("HelloWorld"));
}
@Override
protected String run() throws Exception {
return "Hello World";
}
Future<String> helloWorldResult = new HelloWorldCommand().queue();
//some more work
Stirng message = helloWorldResult.get();