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
String file contents |
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
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="style.css"></link> | |
</head> | |
<body> | |
just some random text... | |
<p> | |
<span id="block1"></span> | |
</p> |
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.apache.http.client.HttpClient; | |
import org.apache.solr.client.solrj.ResponseParser; | |
import org.apache.solr.client.solrj.beans.DocumentObjectBinder; | |
import org.apache.solr.client.solrj.impl.HttpSolrServer; | |
public class ExtendedHttpSolrServer extends HttpSolrServer { | |
private static final long serialVersionUID = -5355794252201598225L; | |
private DocumentObjectBinder binder; |
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.elasticsearch.action.ActionRequestBuilder | |
import org.elasticsearch.action.ActionResponse | |
import org.elasticsearch.action.ActionListener | |
import scala.concurrent.{ Promise, Future } | |
import scala.util.Try | |
object Futurastic { | |
def execute[T, R <: ActionResponse](builder: ActionRequestBuilder[_, R, _])(action: (R) => Try[T]): Future[T] = { |
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
TODO: add notes on configuration |
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 static <R extends Iterable<K>, K, V> R map(Iterable<V> iter, Function<V, K> func){ | |
List<K> result = new LinkedList<K>(); | |
for (V sourceValue : iter) { | |
result.add(func.apply(sourceValue)); | |
} | |
return (R)result; | |
} | |
public static interface Function<S, R> { | |
R apply(S value); |
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 static String mkString(Iterable<?> values, String start, String sep, String end){ | |
// if the array is null or empty return an empty string | |
if(values == null || !values.iterator().hasNext()) | |
return ""; | |
// move all non-empty values from the original array to a new list (empty is a null, empty or all-whitespace string) | |
List<String> nonEmptyVals = new LinkedList<String>(); | |
for (Object val : values) { | |
if(val != null && val.toString().trim().length() > 0){ | |
nonEmptyVals.add(val.toString()); |
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
Array.prototype.contains = function(val, eqFunc /* (val, arrVal) */){ | |
eqFunc = eqFunc || function(val1, val2){return val1 == val2;}; | |
for(var i = 0; i < this.length; i++){ | |
if(eqFunc(val, this[i])){ | |
return true; | |
} | |
} | |
return false; |
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.text.ParseException; | |
import java.text.SimpleDateFormat; | |
public final class DateConverter { | |
private SimpleDateFormat formatterFrom; | |
private SimpleDateFormat formatterTo; | |
private DateConverter(){ | |
super(); | |
} |
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 net.caoticode.spring.interceptors.conditional; | |
import javax.servlet.http.HttpServletRequest; | |
import org.springframework.context.ApplicationContext; | |
public interface AccessCondition { | |
boolean test(HttpServletRequest request, ApplicationContext context); | |
} |
NewerOlder