Skip to content

Instantly share code, notes, and snippets.

View vmarquez's full-sized avatar

Vincent Marquez vmarquez

  • Irvine, CA
View GitHub Profile
date cases county
02-01-2020 1 Orange
02-02-2020 0 Orange
02-03-2020 0 Orange
02-04-2020 0 Orange
02-05-2020 0 Orange
02-06-2020 0 Orange
02-07-2020 0 Orange
02-08-2020 0 Orange
02-09-2020 0 Orange
public class Event {
@PartitionKey(0) public UUID accountId
@PartitionKey(1)public String yearMonthDay;
@ClusteringKey public UUID eventId;
//other data...
}
public static void sampleUsage() {
//we want to ONLY query data from three years ago for a set of accounts, so we will generate that somehow.
//Also note that one token will likely generate many Events...
object Test {
import scalaz.\/
import scala.concurrent.{ExecutionContext, Await, Future}
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import scalaz.syntax.std.option._
def flipOption[A](l: List[Option[A]]): Option[List[A]] =
l.foldLeft(List[A]().some)
((accumulator: Option[List[A]], optiona: Option[A]) => accumulator.flatMap((la: List[A]) => optiona.map((a: A) => a :: la)))
import scalaz._
import Scalaz._
import IndexedStateT._
type ParserM[S, A] = EitherT[({ type l[a] = StateT[Trampoline, S, a]})#l, String, A]
def getVerbose[S]: ParserM[S, S] = {
//https://github.com/scalaz/scalaz/blob/series/7.3.x/core/src/main/scala/scalaz/MonadState.scala
val monadState = stateTMonadState[S, Trampoline]
val state: StateT[Trampoline, S, S] = monadState.get
As a past and future speaker of LambdaConf, I wanted to share my thoughts on the Curtis Yarvin controversy. I do not agree
with excluding attendees nor speakers because of their beliefs or writings. However, it has become clear to me that Curtis Yarvin
has been and continues to be disingenuous when it comes to his claim of separating himself from his 'Moldbug' persona. This, combined
with his large sphere of influence in a repgunant political movement leads me to believe having Curtis at LambdaConf will detract from
the overall goal of spreading functional programming as well as reaching under represented groups. I do not support Lambda Conf's
decision to allow Curtis Yarvin to speak in 2016. I coninue to support LambdaConf's overall mission of inclusion, am happy to see they
continue to offer divirsity scholarships, and plan on speaking in 2016 despite Curtis Yarvin's attendance.
@vmarquez
vmarquez / SeparateTasks.scala
Last active January 13, 2016 05:23
SeparateTasks.scala
def taskSeparation[F[_], A](fa: List[F[A]])(implicit M: Catchable[F], N: Nondeterminism[F]): F[(List[Throwable], List[A])] =
N.gatherUnordered(fa.map(f => M.attempt(f))).map(_.separate)
def liftT[G[_[_], _], M[_]: Monad, A](a: M[A])(implicit ML: MonadLiftT[G, F], M: Monad[M]): G[M, A] = ML.liftT[M, A](M.map(a)(aa => point(aa)))
[core] λ test:console
[info] Starting scala interpreter...
[info]
Loading...
Welcome to the Ammonite Repl 0.4.7
(Scala 2.10.4 Java 1.8.0_60)
@ "hello"
java.lang.NullPointerException
com.sqality.scct.IO$class.relativePath(IO.scala:74)
com.sqality.scct.IO$.relativePath(IO.scala:6)
object StateApply {
import scalaz._
implicit def applyState[F[_], A](implicit F: Applicative[F], S: Semigroup[A]): Applicative[({ type l[a] = StateT[F, A, a]})#l] = new Applicative[({ type l[a] = StateT[F, A, a]})#l] {
def point[B](b: => B): StateT[F, A, B] = StateT[F, A, B]((a:A) => F.point((a,b)))
def ap[B, C](fa: => StateT[F, A, B])(f: => StateT[F, A, B => C]): StateT[F, A, C] = {
StateT[F, A, C]((s: A) => {
val sa = fa.run(s)
val sb = f.run(s)
package stackotalk
import scalaz._
import Scalaz._
import org.joda.time._
object Dates {
def generateDates(sd: DateTime, ed: DateTime): List[DateTime] = {
if (sd isBefore ed)
sd :: generateDates(sd.plusDays(1), ed)