Skip to content

Instantly share code, notes, and snippets.

@shajra
shajra / church.py
Last active December 8, 2015 17:04
Church-encodings in Python
# coding=UTF-8
# Python Goes To Church
# =====================
# What would Python be like if all we had was simple (single argument) lambda
# expressions? We could write some helpful functions like these:
id = lambda a: a
@shajra
shajra / twitter.scala
Created November 2, 2015 20:02 — forked from bryce-anderson/twitter.scala
slapped together bits of a basic http4s interface to the Twitter streaming API. OAuth not included.
// a simple process1 that splits the frames up based on a "\r\n" sequence of chars
val partitioner = {
import java.util.regex.Pattern
import scalaz.stream.process1
import scalaz.std.string._
val pattern = Pattern.compile("\r\n")
process1.repartition { s: String =>
pattern.split(s, -1)
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
import Control.Lens
import Data.Maybe
import Data.Monoid
data Constant a b =
Constant a
@shajra
shajra / gist:d383179fbf260b4e5978
Last active August 29, 2015 14:27 — forked from nkpart/gist:cc852b43d948a33a04c8
Using ghcid inside of emacs
Pieces you need:
* emacs
* ghcid
ghcid needs to know the height of the terminal, we'll set it explicitly
height = (window-height) - (scroll-margin) - 1
set this height as your term-buffer-maximum-size
@shajra
shajra / maxims.md
Last active September 23, 2024 08:34
Maxims for Software Development

Basic Humanity

  • Everyone is safe, respected, and treated with empathy and dignity.
  • Pay is competitive, fair, and relatively transparent.
  • Capitalize on a culture of looking at other jobs in other companies.

Organization

  • Titled leaders deeply respect their implicit influence.
  • Managers of technical workers are always highly technically skilled.
@shajra
shajra / HttpCommand.scala
Created February 26, 2015 18:28
some snippets about retry abstractions in Scala
package shajra.http.client
import scala.concurrent.duration.Duration
import scalaz.{Functor, NonEmptyList}
private[client] sealed abstract class HttpCommand[C, E, O] {
@shajra
shajra / before_monads.md
Last active August 29, 2015 14:11
Before jumping into monads. . .

Before Jumping into Monads

A lot of people come from popular languages that tout being "object-oriented" and they hear about something called "monads" but haven't found the time to figure them out completely. They look for a simple explanation, but run into one or more of the following problems:

  • too many concepts explained at once
  • vague explanations (including analogies that break)
@shajra
shajra / fork.md
Last active August 29, 2015 14:11
talking honestly about a Typelevel Scalaz fork

I've been thinking about this for some time, and I think differences between Lars and Tony may be irreconcilable on their respective stated principles.

Also, I'm coming to the conclusion that a Typelevel fork of Scalaz is not a bad idea if Lars's and Tony's values are as uncompromising as they both suggest.

The obvious, but I'm stating it anyway

@shajra
shajra / scala.getting_started.md
Last active August 29, 2015 14:10
Getting started with Scala using SBT

If you don't know much about Scala, but want to get started quickly. It's by no means an guide to Scala or SBT, the build system for Scala I'm recommending for getting started. There's a learning curve to picking up both Scala and SBT. All I'd like to do is remove the barrier to entry, so you can begin your study.

I'm going to assume you've done some programming in some other language, but not necessarily work on the Java virtual machine (JVM), which Scala targets.

I'm also going to assume you have a Java Developer Kit (JDK) already installed

@shajra
shajra / oo_vs_fp.response.md
Last active August 29, 2015 14:10
response to Bob Martin's "OO vs FP" post

A Response to a Response

Bob Martin wrote a blog article titled "OO vs FP".

Bob has a style of writing that makes it hard for some to see clearly his position objectively. In fact, his post is itself a response to a slide from another presentation arguably suffering from the same qualities.