- Download Emacs from https://emacsformacosx.com or use your favorite distribution, but then make sure to have an
EMACSCLIENTpath exported - Create
~/bin/emacsclient - Create
~/bin/edit - Make sure
~/binis on yourPATHand has precedence over/usr/bin(otherwise the default MacOSemacsclientwill be visible, which you should avoid) - Edit your
emacs.el
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
| /** Lightweight encoding for the "Priority" pattern. | |
| * | |
| * This type will attempt to provide an implicit instance of `P` | |
| * (the preferred type). If that type is not available it will | |
| * fallback to `F` (the fallback type). If neither type is available | |
| * then a `Priority[P, F]` instance will not be available. | |
| * | |
| * As described in the | |
| * [[https://github.com/typelevel/algebra/ Typelevel Algebra]] | |
| * project, but with a lighter encoding that does not require |
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 java.io._ | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import scala.util.control.NonFatal | |
| import scala.concurrent.duration._ | |
| import scalaz._ | |
| import scalaz.effect._ | |
| object Sample extends SafeApp { | |
| def run(args: List[String]): IO[Unit] = | |
| for { |
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
| /** | |
| * Asynchronous Semaphore, made to work with Promises. | |
| * | |
| * ``` | |
| * const delay = (ms: number) => | |
| * new Promise<void>(_ => setTimeout(_, ms)) | |
| * | |
| * const semaphore = new AsyncSemaphore(10) | |
| * const promises: Promise<void>[] = [] |
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
| #!/usr/bin/env node | |
| import { IO, Try, Success, Failure, Either, Left, Right, Cancelable, Duration } from "funfix" | |
| import { RequestResponse } from "request" | |
| import * as fs from "fs" | |
| import * as request from "request" | |
| import * as Url from "url" | |
| import * as cheerio from "cheerio" | |
| import * as minimist from "minimist" |
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 scala.language.higherKinds | |
| sealed abstract class Stuff[F[_], +A] | |
| case class Suspend[F[_], A](a: () => F[A]) | |
| extends Stuff[F, A] | |
| // This function fails compilation compilation with: | |
| // | |
| // found : Suspend[F,?A1] where type ?A1 <: A (this is a GADT skolem) |
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 java.util.concurrent.TimeUnit | |
| import org.openjdk.jmh.annotations._ | |
| import scala.util.Random | |
| @State(Scope.Thread) | |
| @BenchmarkMode(Array(Mode.Throughput)) | |
| @OutputTimeUnit(TimeUnit.SECONDS) | |
| class IteratorBenchmark { | |
| @Param(Array("8")) | |
| var cycles = 0 |
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 monix.eval.Task | |
| import java.util.concurrent.TimeUnit | |
| import scala.concurrent.duration._ | |
| /** Request limiter for APIs that have quotas per second, minute, hour, etc. | |
| * | |
| * {{{ | |
| * // Rate-limits to 100 requests per second | |
| * val limiter = TaskLimiter(TimeUnit.SECONDS, limit = 100) | |
| * |
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 scalaz._ | |
| import scalaz.concurrent.Task | |
| def signal(i: Int): Task[Int] = | |
| Task.async[Int] { cb => cb(\/-(i)) } | |
| def loop(n: Int, acc: Int): Task[Int] = | |
| signal(acc + n).flatMap { x => | |
| if (n <= 0) Task.now(acc) | |
| else loop(n-1, x) |
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 shade.local | |
| import shade.local.ImmutableCache.{Timestamp, Value} | |
| import scala.annotation.tailrec | |
| import scala.collection.immutable.SortedMap | |
| import scala.concurrent.duration._ | |
| /** Describes an immutable cache data-structure. | |
| * | |
| * It behaves much like a standard `scala.collection.immutable.Map`, but |