Skip to content

Instantly share code, notes, and snippets.

As compiled by Kevin Wright a.k.a @thecoda

(executive producer of the movie, and I didn't even know it... clever huh?)

please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!

This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!

Monday June 16th

@ceedubs
ceedubs / gist:f8273ede78f86df7df7f
Last active August 29, 2015 14:07
Turning List[Int => Int] into Int => List[Int] with sequenceU
import scalaz.std.list._
import scalaz.std.function._
import scalaz.syntax.traverse._
val add1: Int => Int = _ + 1
val times2: Int => Int = _ * 2
val squared: Int => Int = n => n * n
// sequenceU requires that List has a Traverse instance
// and that Function1 (for Int => Int in this case) has an Applicative instance
// luckily, scalaz provides both
@rbranson
rbranson / gist:03d88e3733c6ee098a89
Last active July 25, 2017 15:17
My Thoughts on Rust

Rust is the first language that has emerged in the past few years that solves enough of my problems that it would be worth not only learning & teaching an entirely new language, but also sacrificing the maturity of the language ecosystems I’ve become accustomed to.

I highly suggest you read the "Guide" provided by the language developers or this won't make much sense. These are just some of my thoughts and are intended to highlight particular things that stand out to me. I am just a practitioner and not an expert in any of these languages, so I have probably made some incorrect assumptions and out-of-date assertions. Bare with me.

Rust feels like the first time momentum has gained behind a true systems programming language that uses modern PL design techniques to prevent common errors when dealing with memory. It seems like others have previously either been too anemic to be worth adopting or too abstract to provide proper control. The type system and assignment semantics are designed specifically to preven

@paulp
paulp / hey.scala
Created September 14, 2014 03:08
class Bippy(override val toString: String)
trait A { implicit def lowPriority: Bippy = new Bippy("A") }
object B extends A { implicit def highPriority: Bippy = new Bippy("B") }
object C { implicit def highPriority: Bippy = new Bippy("C") }
object Test {
def main(args: Array[String]): Unit = {
import B._, C._
println( implicitly[Bippy] ) // Prints: A
package psp
import sbt._, Keys._, scala.util.Try
package object stub extends stub.LibSbtStub {
lazy val props = new SbtBuildProps()
lazy val pspBintray = new Bintray("paulp")
def buildSettings = quietSettings ++ Seq(resolvers ++= pspBintray.repos) ++ addSbtPlugin(pspOrg % "psp-libsbt" % dependVersion)
def projectSettings = quietSettings
import scala.concurrent._
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits._
import scala.util.{ Success, Failure }
import akka.actor._
import akka.pattern.{ after, ask, pipe }
import akka.util.Timeout
object LogSearch extends App {
In Sublime Text 3, I multi-selected 50 positions and wanted to insert a different number on each line.
a) google search
b) discover "Text Pastry" via stack overflow answer
c) install text pastry sublime plugin (cmd-shift-P install)
d) cmd-shift-P pastry, choose "Text Pastry From 1 to X"
Total time elapsed, maybe 10 seconds.
I maintained my multi-selection and the extension inserted the numbers exactly as desired.
ionic
https://cloud.genymotion.com/page/launchpad/download/
http://ngcordova.com/docs/
http://ionicframework.com/creator/
https://github.com/driftyco/collide
// a ∨ (b ∨ c) = (a ∨ b) ∨ c, a ∧ (b ∧ c) = (a ∧ b) ∧ c associativity
// a ∨ b = b ∨ a, a ∧ b = b ∧ a commutativity
// a ∨ (a ∧ b) = a, a ∧ (a ∨ b) = a absorption
// a ∨ 0 = a, a ∧ 1 = a identity
// a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c), a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c) distributivity
// a ∨ ¬a = 1, a ∧ ¬a = 0 complements
class AlgebraPoliceman[A : BooleanAlgebra : Arbitrary : Eq]() extends Properties("BooleanAlgebra") {
def zero = implicitly[BooleanAlgebra[A]].zero
def one = implicitly[BooleanAlgebra[A]].one
@jdegoes @puffnfresh The Email/String smart constructor is a Prism. /cc @d6 @luqui
@dibblego @puffnfresh @d6 @luqui Preferred solution: correct model of email. Pragmatic solution: Prism / smart constructor on String.
(private thought: what could "correct model of email" mean? What is so "pragmatic solution" about Prism?)
@jdegoes @puffnfresh @d6 @luqui what is "correct model of email"? Do you mean only allow correct construction?
@dibblego @puffnfresh @d6 @luqui i.e. a data structure (ADT) which is naturally isomorphic to the set of all valid emails.