Skip to content

Instantly share code, notes, and snippets.

@androidfred
androidfred / haskell_stack_and_intellij_idea_ide_setup_tutorial_how_to_get_started.md
Last active August 8, 2024 07:24
Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started

Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started

Upon completion you will have a sane, productive Haskell environment adhering to best practices.

Basics

  • Haskell is a programming language.
  • Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
  • Intellij IDEA IDE is a popular IDE.

Install required libraries

sudo apt-get install libtinfo-dev libghc-zlib-dev libghc-zlib-bindings-dev

@squito
squito / GroupedRDD.scala
Last active August 29, 2015 14:17
GroupedRDD
import java.io.{IOException, ObjectOutputStream}
import scala.language.existentials
import scala.reflect.ClassTag
import org.apache.spark._
import org.apache.spark.rdd.RDD
case class GroupedRDDPartition(
@codetinkerhack
codetinkerhack / ReTry.scala
Last active June 18, 2020 09:39
Retry Akka actor /Ask pattern with individual timeout, retry intervals
package com.codetinkerhack
import akka.actor.{ ActorRef, Props, Actor, ActorLogging }
import akka.pattern.ask
import akka.util.Timeout
import scala.concurrent.duration._
import akka.actor.Actor.Receive
import akka.pattern.pipe
import scala.util.Success
import scala.util.Failure
public class JaccardScoreScript extends AbstractDoubleSearchScript
{
private final ESLogger logger = Loggers.getLogger(JaccardScoreScript.class);
private final double coefficient;
private final String docItemField;
private final String docItemScoreField;
private final List<Long> queryItems;
private final List<Double> queryItemScores;
private final boolean zero;
.twitter-typeahead .tt-hint {
border: 0;
padding: 0;
}
.tt-dropdown-menu {
min-width: 160px;
margin-top: 2px;
padding: 5px 0;
background-color: #fff;
@ryanlecompte
ryanlecompte / gist:5746241
Last active October 31, 2019 05:05
Bounded priority queue in Scala
import scala.collection.mutable
/**
* Bounded priority queue trait that is intended to be mixed into instances of
* scala.collection.mutable.PriorityQueue. By default PriorityQueue instances in
* Scala are unbounded. This trait modifies the original PriorityQueue's
* enqueue methods such that we only retain the top K elements.
* The top K elements are defined by an implicit Ordering[A].
* @author Ryan LeCompte ([email protected])
*/