View server.rb
This file contains 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
post '/junit-results' do | |
result = JSON.parse(request.body.read) | |
passes = result['stats']['passes'] | |
failures = result['stats']['failures'] | |
File.open(File.dirname(__FILE__) + '/../../target/artifacts/reports/javascript.xml', 'w') do |f| | |
xml = Builder::XmlMarkup.new | |
suite = xml.testsuite :errors => 0, :failures => failures, :tests => passes, :name => "javascript.tests" do | |
result['results'].each do |tc| | |
unless tc.nil? | |
tc['specs'].each do |s| |
View HackedParametersProvider.java
This file contains 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 HackedParametersProvider extends OgnlParametersProvider { | |
public HackedParametersProvider(...., HttpServletRequest request, ...) { | |
super(....., new HackedRequest(request), ....); | |
} | |
} |
View FreemarkerPathResolver.java
This file contains 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 FreemarkerPathResolver extends DefaultPathResolver { | |
//delegate constructor | |
@Override | |
protected String getPrefix() { | |
return "/WEB-INF/freemarker/"; | |
} | |
View DisplayTag.java
This file contains 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
@Target(ElementType.METHOD) | |
@Retention(RetentionType.RUNTIME) | |
public @interface DisplayTag { | |
String value(); | |
} |
View Basket.java
This file contains 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
public class Basket implements HypermediaResource { | |
private int id; | |
private String name; | |
public void configureRelations(RelationBuilder builder) { | |
builder.relation("self").uses(ItemController.class).showItem(id); | |
builder.relation("basket").at("/Basket/add/"+id); | |
} |
View Out.java
This file contains 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
@Documented | |
@Retention(RetentionPolicy.RUNTIME) | |
@Target(ElementType.FIELD) | |
public @interface Out { | |
} |
View TenantRoutesParser.java
This file contains 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 | |
@ApplicationScoped | |
public class TenantRoutesParser implements RoutesParser { | |
private final RoutesParser parser; | |
public TenantRoutesParser(RoutesParser parser) { | |
this.parser = parser; | |
} |
View CustomProvider.java
This file contains 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
package my.apps.package; | |
public class CustomProvider extends GuiceProvider { | |
static class CustomModule extends AbstractModule { | |
private final Module module; | |
CustomModule(Module module) { | |
this.module = module; | |
} |
View Calculadora.java
This file contains 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
public class Calculadora { | |
private static final Prova _ = of(Prova.class); | |
public double mediaDeProvas(List<Prova> provas) { | |
return mediaPonderada(provas, function(_.getNota()), function(_.getPeso())); | |
} | |
public <T> double mediaPonderada(List<T> lista, Function<T, Double> valor, Function<T, Double> peso) { | |
double soma = 0.0; | |
double somaPesos = 0.0; |
View ActiveRecord.scala
This file contains 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 | |
class ActiveRecord[T](session:Session) { | |
implicit def obj2AR(obj:T) = new AR(session, obj) | |
} | |
class AR[T](session:Session, obj:T) { | |
def save = session.save(obj) | |
} |
OlderNewer