Skip to content

Instantly share code, notes, and snippets.

View tomdwaggy's full-sized avatar

Tom the Dragon tomdwaggy

View GitHub Profile
// ==UserScript==
// @name Example from http://stackoverflow.com/q/6834930
// @version 1.3
// @namespace http://stackoverflow.com/q/6834930
// @description Allow reverse playlist in Youtube
// @include https://www.youtube.com/*
// ==/UserScript==
function load(url, onLoad, onError) {
e = document.createElement("script");
@tomdwaggy
tomdwaggy / yt-set-focus-key.user.js
Created October 1, 2014 00:25
Youtube Set Focus on Keypress
// ==UserScript==
// @name Youtube Set Focus on Keypress
// @namespace http://muckdragon.info/userscripts
// @version 0.1
// ==/UserScript==
(function(){
document.addEventListener('keydown', function(e) {
// pressed alt+g
if (e.keyCode == 71 && !e.shiftKey && e.ctrlKey && e.altKey && !e.metaKey) {
@tomdwaggy
tomdwaggy / allow-anonymous-basic-auth.web.xml
Last active August 29, 2015 14:17
allow-anonymous-basic-auth
<snippet>
<security-constraint>
<web-resource-collection>
<web-resource-name>RequireAuthentication</web-resource-name>
<description>Secured page for forcing the container to request login</description>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
package io.github.arven.rs.services.example;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Predicates;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
class io.github.arven.rs.services.example.MicroBlogApplication$NextApiListingResource
public javax.ws.rs.core.Response com.wordnik.swagger.jaxrs.listing.ApiListingResource.getListingJson(javax.ws.rs.core.Application,javax.servlet.ServletConfig,javax.ws.rs.core.HttpHeaders,javax.ws.rs.core.UriInfo)
@tomdwaggy
tomdwaggy / reflective-scanner.java
Created April 7, 2015 15:23
Reflective JAX-RS Scanner
ReflectiveJaxrsScanner scanner = new ReflectiveJaxrsScanner();
scanner.setResourcePackage("io.github.arven.rs.services.example");
ScannerFactory.setScanner(scanner);
@FlareServlet(value = "/example/*", filters = {ApiOriginFilter.class})
public Servlet jaxrsServlet() {
return new CXFNonSpringJaxrsServlet(CDI.current().select(MicroBlogApplication.class).get());
}
package io.github.arven.rs.services.example;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import javax.inject.Inject;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
cd C:\Users\brian.becker\Git\java-rest-examples\tomee-cxf-jaxrs; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0_71" cmd /c "\"\"C:\\Program Files\\NetBeans 8.0.2\\java\\maven\\bin\\mvn.bat\" -Dexec.args=\"-classpath %classpath io.github.arven.rs.services.example.flare.Application\" -Dexec.executable=java -Dexec.classpathScope=runtime -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.0.2\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\""
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Scanning for projects...
------------------------------------------------------------------------
Building service-example-tomee-embedded-jaxrs 1.0.0-SNAPSHOT
------------------------------------------------------------------------
The POM for org
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.arven.rs</groupId>
<artifactId>service-example-tomee-embedded-jaxrs</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>