This file contains hidden or 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
object MD5 { | |
def hash(s: String) = { | |
val m = java.security.MessageDigest.getInstance("MD5") | |
val b = s.getBytes("UTF-8") | |
m.update(b, 0, b.length) | |
new java.math.BigInteger(1, m.digest()).toString(16) | |
} | |
} |
This file contains hidden or 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 storm.starter.bolt; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Set; | |
import java.util.Timer; | |
import java.util.TimerTask; | |
import org.joda.time.DateTime; |
This file contains hidden or 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
{ | |
"max_variables": 3, | |
"functions": { | |
"0": "-age" | |
}, | |
"index_code": "dgmqn", | |
"allows_facets": true, | |
"ram": 600, | |
"log_server_host": "index123.localhost", | |
"autocomplete": true, |
This file contains hidden or 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 models; | |
import java.util.Date; | |
import java.util.List; | |
import java.util.Set; | |
import java.util.UUID; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; |
This file contains hidden or 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
/* | |
* This is the Towers of Hanoi example from the prolog tutorial [1] | |
* converted into Scala, using implicits to unfold the algorithm at | |
* compile-time. | |
* | |
* [1] http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_3.html | |
*/ | |
object TowersOfHanoi { | |
import scala.reflect.Manifest |
This file contains hidden or 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.lucene.queryParser.QueryParser | |
import org.apache.lucene.search._ | |
import org.apache.lucene.analysis._ | |
import org.apache.lucene.analysis.en.EnglishAnalyzer | |
import org.apache.lucene.analysis.tokenattributes._ | |
import org.apache.lucene.util.Version.LUCENE_35 | |
case class TextQuery(analyzer: Analyzer) { | |
val parser = new QueryParser(LUCENE_35 , "dummyfield", analyzer) | |
def fromString(searchTerms: String) = { |
This file contains hidden or 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
# Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences. | |
# Instructions: | |
# Go to TextMate > Preferences... | |
# Click Advanced | |
# Select Folder References | |
# Replace the following: | |
# File Pattern |
This file contains hidden or 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.lucene.analysis.standard.StandardAnalyzer; | |
import org.apache.lucene.document.Document; | |
import org.apache.lucene.facet.index.CategoryDocumentBuilder; | |
import org.apache.lucene.facet.index.params.DefaultFacetIndexingParams; | |
import org.apache.lucene.facet.index.params.FacetIndexingParams; | |
import org.apache.lucene.facet.search.DrillDown; | |
import org.apache.lucene.facet.search.FacetsCollector; | |
import org.apache.lucene.facet.search.params.CountFacetRequest; | |
import org.apache.lucene.facet.search.params.FacetRequest; | |
import org.apache.lucene.facet.search.params.FacetSearchParams; |
This file contains hidden or 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 com.twitter.scalding._ | |
import scala.util.parsing.json._ | |
class ParseJsonJob(args: Args) extends Job(args) { | |
TextLine(args("input")) | |
.map(('line) -> ('parseStatus, 'uri)) { | |
line: String => { | |
JSON.parseFull(line) match { | |
case Some(data: Map[String, String]) => ("success", data("uri")) | |
case None => ("failed", "") |
This file contains hidden or 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> | |
<meta charset="utf-8"> | |
<style> | |
.node { | |
font: 10px sans-serif; | |
} | |
.link { | |
stroke: steelblue; |