Skip to content

Instantly share code, notes, and snippets.

Avatar

Colin Woodbury fosskers

View GitHub Profile
View 2019-lambdaconf-haskell.org

Haskell in Production: Adventures in Blockchain Building

@fosskers
fosskers / 2019-polyglot-haskell-dancing.org
Created May 27, 2019
Dancing in Haskell: Beauty, Correctness, and Good Technique
View 2019-polyglot-haskell-dancing.org

Dancing in Haskell: Beauty, Correctness, and Good Technique

Beauty, Correctness, and Good Technique

View gist:3787785

Arch Packages

and what you should know about them

The Arch Way states:

Arch Linux targets and accommodates competent GNU/Linux users by
giving them complete control and *responsibility* over the system.

Part of this comes from package choice. Users either install from

View SpatialSort.hs
module SpatialSort
( Point(..)
, spatialSort
) where
import Data.List (sortBy)
import Data.Monoid
import Data.Vector (Vector)
import qualified Data.Vector as V
import qualified Data.Vector.Algorithms.Insertion as I
View strange-benchmark-timings.md

Benchmark Timing Oddities

Anecdotally, I had noticed that from run to run, the VectorTile benchmarks weren't returning consistent numbers. My three avenues of suspicion were:

  1. My VT implementation
  2. Scaliper
  3. The JVM
@fosskers
fosskers / MapAlgebra.scala
Created Aug 15, 2016
A suggestion for Monadizing Map Algebra operations, so that they're generic across any Tile type.
View MapAlgebra.scala
/* Eugene (et al.), our mistake might have been that `MapAlgebra` isn't the Monad,
* RDDs are. We'd like to do things like:
* rdd1.localMean(rdd2).flatMap(r => r.focalGradient).flatMap(r => r.moreStuff)
*/
implicit class KeyedRDDMethods[K: Key, A](rdd: RDD[(K,A)]) {
/* Binary operations are naturally expressed as an FP `zipWith` operation.
* There is a keyed variant that works across Map-like containers.
@fosskers
fosskers / emacs-ensime-implicit-highlighting
Created May 17, 2016
In my emacs, basically all of this code has implicit underlining across the entire screen.
View emacs-ensime-implicit-highlighting
class Backend($: BackendScope[ModelProxy[DisplayModel], Unit]) {
def render(proxy: ModelProxy[DisplayModel]) = {
val x = Array[String]().toVector // This highlights correctly
<.div(
proxy().metadata.render(md => {
<.div(
<.h3("Layer Metadata"),
<.p(s"CellType: ${md.cellType}"),
View SentenceParser.rb
#slightly modified
#made it part of a module for your using pleasure
module SentenceParser
#finds the earliest sentence-ending punctuation in the given String
#i realize this isn't pretty
#finds the earliest sentence-ending punctuation in the given String
def find_partition_pos(line)
found = false
pos = nil #the position of the valid sentence ending punctuation
You can’t perform that action at this time.