Skip to content

Instantly share code, notes, and snippets.

View Atry's full-sized avatar
😷
Wear a Mask. Save Lives.

Yang, Bo Atry

😷
Wear a Mask. Save Lives.
View GitHub Profile
@mcku
mcku / translations-udash-t.scala
Created November 27, 2018 18:57
a sample t function for translation
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
@RevySR
RevySR / Adam.sc
Last active December 8, 2017 13:51 — forked from TerrorJack/Adam.sc
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

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 April 6, 2016 08:51 — forked from suhailshergill/RDDasMonadPlus.scala
having monad instances for RDD like things
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 August 2, 2018 13:44
Akka HTTP 1.0 CORS Support
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 February 24, 2019 16:09
having monad instances for RDD like things
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
@andyli
andyli / AbstractClass.hx
Last active June 24, 2021 13:40
Java abstract class implemented in Haxe macros. Related: https://groups.google.com/forum/?fromgroups=#!topic/haxelang/WzeI-N1XbIg
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.
*/