Skip to content

Instantly share code, notes, and snippets.

private boolean resourceTransformed( List<ResourceTransformer> resourceTransformers, String name, InputStream is,
List<Relocator> relocators )
throws IOException
{
boolean resourceTransformed = false;
for ( ResourceTransformer transformer : resourceTransformers )
{
if ( transformer.canTransformResource( name ) )
{
# Just an example.
# @video is a direct reference to a '<video>' element.
# $() is assuming jQuery is being used in this example.
@video.addEventListener("loadedmetadata", (event) =>
actualRatio = @video.videoWidth/@video.videoHeight
targetRatio = $(@video).width()/$(@video).height()
adjustmentRatio = targetRatio/actualRatio
$(@video).css("-webkit-transform","scaleX(#{adjustmentRatio})")
)
public class CurrentUserLoggingFilter implements Filter {
public static final String MDC_CURRENT_ACCOUNT_ID_KEY = "CurrentAccountId";
@Context
HttpContext context;
@Override
public void init(FilterConfig filterConfig) throws ServletException { /* unused */ }
public class CurrentUserLoggingFilter implements Filter {
public static final String MDC_CURRENT_ACCOUNT_ID_KEY = "CurrentAccountId";
@Context
HttpContext context;
@Override
public void init(FilterConfig filterConfig) throws ServletException { /* unused */ }
<html>
<head>
<style type="text/css">
table table {
width: 600px !important;
}
table div + div { /* main content */
width: 65%;
float: left;
}
/* ====================================================================
* eldarion-ajax-core.js v0.10.0
* ====================================================================
* Copyright (c) 2013, Eldarion, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
public class SpelFreemarkerTemplateDirective implements TemplateDirectiveModel {
SpelEvaluator spelEvaluator;
@Required
public void setSpelEvaluator(SpelEvaluator spelEvaluator) {
this.spelEvaluator = spelEvaluator;
}
@Override
public void execute(Environment env, @SuppressWarnings("rawtypes") Map params, TemplateModel[] loopVars,
input {
stdin { }
file {
type => "applogs"
# Wildcards work, here :)
path => [ "/home/alee/workspaces/java-workspaces/elasticsearch-example/graph-presenter/logs/*.log" ]
}
}
public abstract class SpringApplication<T extends SpringConfiguration> extends Application<T> {
/**
* When the application runs, this is called after the {@link io.dropwizard.Bundle}s are run. Override it to add
* providers, resources, etc. for your application.
*
* @param configuration the parsed {@link io.dropwizard.Configuration} object
* @param environment the application's {@link io.dropwizard.setup.Environment}
* @throws Exception if something goes wrong
*/
This is a list of tweaks to make IntelliJ IDEA work better with OpenJDK 8 (64-bit). Refer to https://docs.oracle.com/javase/8/docs/technotes/guides/2d/flags.html for the details of the options used below.
Note that, the performance boost achieved via the OpenGL-based pipeline is made possible by using the latest version (e.g., mesa-dri-drivers-10.3.2-1.20141028.fc21.x86_64) of the open-source Radeon driver (for ATi graphics cards). This might vary based on the types of graphics cards and drivers.
1. Text Anti-aliasing
In $IDEA_HOME/bin/idea64.vmoptions, change
-Dawt.useSystemAAFontSettings=lcd