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
var callback = function(data) { console.log(data); }; | |
var url = "http://somewhere.in/the.web"; | |
if (windows.XDomainRequest) { | |
var xdr = new XDomainRequest(); | |
xdr.open("get", url); | |
xdr.onload = function() { | |
callback(this.responseText, 'success'); | |
}; | |
xdr.send(); |
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
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import org.springframework.web.servlet.HandlerInterceptor; | |
import org.springframework.web.servlet.ModelAndView; | |
public class CrossOriginResourceSharingInterceptor implements | |
HandlerInterceptor { | |
private static final String DEFAULT_ALLOW_ORIGIN = "*"; |
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
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<version>1.7</version> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>shade</goal> | |
</goals> |
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 streams | |
object tests { | |
def xtoy(x: Int, y: List[Int]): List[Int] = { | |
println(x + " @ " + y) | |
x :: y | |
} | |
def ytox(x: List[Int], y: Int): List[Int] = { |
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 iadb.data.utils; | |
import static org.apache.hadoop.hbase.util.Bytes.*; | |
import java.math.BigDecimal; | |
import java.nio.ByteBuffer; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class BytesBuilder { |
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
import java.net.URL; | |
import java.net.URLClassLoader; | |
public class ParentLastClassLoader extends ClassLoader { | |
private ChildURLClassLoader childClassLoader; | |
/** | |
* This class allows me to call findClass on a classloader | |
*/ |
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
import org.codehaus.jackson.JsonParser; | |
import org.codehaus.jackson.JsonProcessingException; | |
import org.codehaus.jackson.Version; | |
import org.codehaus.jackson.map.DeserializationContext; | |
import org.codehaus.jackson.map.JsonDeserializer; | |
import org.codehaus.jackson.map.ObjectMapper; | |
import org.codehaus.jackson.map.module.SimpleModule; | |
import org.codehaus.jackson.node.ObjectNode; | |
public class JacksonObjectMapperUtils { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>JSONP</title> | |
</head> | |
<body> | |
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script> | |
<script type="text/javascript"> | |
$(function() { |
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 ApiAuthenticationEntryPoint implements | |
AuthenticationEntryPoint { | |
@Override | |
public void commence(HttpServletRequest request, | |
HttpServletResponse response, AuthenticationException authException) | |
throws IOException, ServletException { | |
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); | |
} |
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
import java.lang.annotation.Documented; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
@Target(ElementType.PARAMETER) | |
@Retention(RetentionPolicy.RUNTIME) | |
@Documented | |
public @interface RequestAttribute { |