Skip to content

Instantly share code, notes, and snippets.

@mcku
mcku / translations-udash-t.scala
Created Nov 27, 2018
a sample t function for translation
View translations-udash-t.scala
import com.thoughtworks.binding.{Binding, FutureBinding, dom}
import io.udash.i18n.{Bundle, Lang, LocalTranslationProvider, Translated, TranslationKey, TranslationKey0, TranslationKey1, TranslationKey2, TranslationProvider}
import scala.concurrent.Future
import scala.util.{Failure, Success, Try}
import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue
@Rabenda
Rabenda / Adam.sc
Last active Dec 8, 2017 — forked from TerrorJack/Adam.sc
Adam.sc
View Adam.sc
trait Adam extends INDArrayWeights {
import org.nd4j.linalg.ops.transforms.Transforms
trait INDArrayWeightApi extends super.INDArrayWeightApi {
this: INDArrayWeight =>
private var m0: Option[INDArray] = None
def m = m0.getOrElse(Nd4j.zeros(data.shape: _*))
def m_=(value: INDArray) = m0 = Some(value)
private var v0: Option[INDArray] = None
View goscala.md

Go vs. Scala (Akka) Concurrency

A comparison from 2 weeks using Go.

Actors vs. Functions

Akka's central principle is that there you have an ActorSystem which runs Actors. An Actor is defined as a class and it has a method to receive messages.

@Atry
Atry / RDDasMonadPlus.scala
Created Apr 6, 2016 — forked from suhailshergill/RDDasMonadPlus.scala
having monad instances for RDD like things
View RDDasMonadPlus.scala
object RDDasMonadPlus {
import org.apache.spark.{ SparkContext }
import org.apache.spark.rdd.RDD
import scalaz._
import Scalaz._
import scala.reflect.ClassTag
// RDDMPlus is the type for which we will define the Monad instance. it can be
// constructed from an RDD using the RDDClassTag constructor. this
// implementation is based on insights from
@pcting
pcting / AkkaHttpCorsSupport.scala
Last active Aug 2, 2018
Akka HTTP 1.0 CORS Support
View AkkaHttpCorsSupport.scala
import akka.http.scaladsl.model.HttpHeader
import akka.http.scaladsl.model.HttpMethods._
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.model.headers.`Access-Control-Allow-Credentials`
import akka.http.scaladsl.model.headers.`Access-Control-Allow-Methods`
import akka.http.scaladsl.model.headers.`Access-Control-Allow-Origin`
import akka.http.scaladsl.model.headers.Origin
import akka.http.scaladsl.server.Directive0
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.MethodRejection
@suhailshergill
suhailshergill / RDDasMonadPlus.scala
Last active Feb 24, 2019
having monad instances for RDD like things
View RDDasMonadPlus.scala
object RDDasMonadPlus {
import org.apache.spark.{ SparkContext }
import org.apache.spark.rdd.RDD
import scalaz._
import Scalaz._
import scala.reflect.ClassTag
// RDDMPlus is the type for which we will define the Monad instance. it can be
// constructed from an RDD using the RDDClassTag constructor. this
// implementation is based on insights from
View AbstractClass.hx
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Type;
using Lambda;
/**
Old school abstract class.
Classes that implements it, and their sub-classes, will be able to declare abstract methods (methods that without body).
There will be a check in compile-time such that no public constructor is allowed without all abstract methods implemented.
*/
You can’t perform that action at this time.