Skip to content

Instantly share code, notes, and snippets.

# 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})")
)
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 ) )
{
#!/bin/sh
# set the configuration variables below, before running the script
# get the solr nightly build download link from https://builds.apache.org/job/Solr-Artifacts-4.x/lastSuccessfulBuild/artifact/solr/package/
JETTY_URL="http://eclipse.org/downloads/download.php?file=/jetty/stable-9/dist/jetty-distribution-9.0.5.v20130815.tar.gz&r=1"
JETTY_HOME="/opt/jetty"
JAVA='/usr/local/jdk1.7.0_09/bin/java'
JETTY_PORT=8085
JETTY_HOST=127.0.0.1
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ test ---
[INFO] com.example:test:jar:1.0-SNAPSHOT
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.3.0-SNAPSHOT:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.0-SNAPSHOT:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0-SNAPSHOT:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.3.0-SNAPSHOT:compile
[INFO] \- com.codahale.dropwizard:dropwizard-core:jar:0.7.0-SNAPSHOT:compile
[INFO] +- com.codahale.dropwizard:dropwizard-util:jar:0.7.0-SNAPSHOT:compile
[INFO] | +- com.google.guava:guava:jar:14.0.1:compile
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper#getUserPrincipal
old:
public Principal getUserPrincipal() {
Authentication auth = getAuthentication();
if ((auth == null) || (auth.getPrincipal() == null)) {
return null;
}
protected long getGeneratedLongKey(PreparedStatement stmt) throws SQLException {
ResultSet rs = null;
long result = 0;
try {
rs = stmt.executeQuery("SELECT @@IDENTITY");
rs.next();
result = rs.getLong(1);
} finally {
if (rs != null)
rs.close();
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
description "service"
start on filesystem
stop on runlevel S
respawn
respawn limit 10 5
oom never
kill timeout 86400 #If it's given a stop order, this is how long it will take to stop.
@WebServlet("/upload")
@MultipartConfig(location = "/tmp")
public class FileUploadServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
getServletContext().getRequestDispatcher("/WEB-INF/views/fileUpload.jsp").forward(req, res);
}
@Override
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0.1</version>
<dependencies>
<dependency>
<groupId>magnet.toolchain</groupId>
<artifactId>magnet-enforce-plugin-rules-extension</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>