Skip to content

Instantly share code, notes, and snippets.

View BenWhitehead's full-sized avatar

BenWhitehead BenWhitehead

  • Google
  • New York City, New York
View GitHub Profile
@johnynek
johnynek / JsonInjectionExample
Last active December 23, 2015 18:09
Json injection example with case classes to Maps.
scala> case class Wrapped(x: Int, y: Long)
defined class Wrapped
scala> import com.twitter.bijection._
import com.twitter.bijection._
scala> import com.twitter.bijection.json._
import com.twitter.bijection.json._
scala> import com.twitter.bijection.json.JsonNodeInjection._
@johnynek
johnynek / Future.rs
Created November 13, 2014 04:20
Future with map and monadic bind in Rust.
use std::comm::{Receiver, channel};
use std::io;
use std::mem::replace;
use std::task::spawn;
struct Future<'a, A> {
state: FutureState<'a, A>
}
@non
non / mark.scala
Created January 3, 2017 15:00
Scala solver for Mark Dominus' arithmetic puzzle (http://blog.plover.com/math/17-puzzle.html).
package mark
import spire.math.{ Rational => Q }
object Solver2 {
case class Op(name: String, run: (Q, Q) => Option[Q])
val ops: List[Op] = List(
Op("+", (x, y) => Some(x + y)),
@cryzed
cryzed / fix-infinality.md
Last active June 24, 2024 02:24
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08:

@SystemFw
SystemFw / Free conversation.md
Last active October 17, 2023 09:57
Explaining some of the mechanics of interpretation of Free programs

Balaji Sivaraman @balajisivaraman_twitter

Hi all, I need some help understanding a piece of Doobie code from the examples. It is the StreamingCopy one: (https://github.com/tpolecat/doobie/blob/series/0.4.x/yax/example/src/main/scala/example/StreamingCopy.scala). I am using a modified version of the fuseMap2 example from that file. Here’s how I’ve modified it for my requirements:

  def fuseMap[F[_]: Catchable: Monad, A, B](
      source: Process[ConnectionIO, A],
      sink: Vector[A] => ConnectionIO[B],
      delete: ConnectionIO[Unit]
  )(
 sourceXA: Transactor[F],