Skip to content

Instantly share code, notes, and snippets.

View kpmeen's full-sized avatar
👾

Knut Petter Meen kpmeen

👾
View GitHub Profile
apply plugin: 'java'
apply plugin: 'scala'
// For those using Eclipse or IntelliJ IDEA
apply plugin: 'eclipse'
apply plugin: 'idea'
def findPlay20(){
def pathEnvName = ['PATH', 'Path'].find{ System.getenv()[it] != null }
for(path in System.getenv()[pathEnvName].split(File.pathSeparator)){
for(playExec in ['play.bat', 'play.sh', 'play']){
@kpmeen
kpmeen / nxfetch.sh
Created January 28, 2014 07:36 — forked from adutra/nxfetch.sh
#!/bin/bash
# Argument = -h -v -i groupId:artifactId:version -c classifier -p packaging -r repository
#shopt -o -s xtrace
# Define Nexus Configuration
NEXUS_BASE=http://repository.example.com:8081/nexus
REST_PATH=/service/local
ART_REDIR=/artifact/maven/redirect

Git DMZ Flow

I've been asked a few times over the last few months to put together a full write-up of the Git workflow we use at RichRelevance (and at Precog before), since I have referenced it in passing quite a few times in tweets and in person. The workflow is appreciably different from GitFlow and its derivatives, and thus it brings with it a different set of tradeoffs and optimizations. To that end, it would probably be helpful to go over exactly what workflow benefits I find to be beneficial or even necessary.

  • Two developers working on independent features must never be blocked by each other
    • No code freeze! Ever! For any reason!
  • A developer must be able to base derivative work on another developer's work, without waiting for any third party
  • Two developers working on inter-dependent features (or even the same feature) must be able to do so without interference from (or interfering with) any other parties
  • Developers must be able to work on multiple features simultaneously, or at lea

Stash Shortcomings (relative to GitHub)

Doesn't work on mobile ANYTHING!!! This item should be on a giant, 2 meter poster in the Atlassian office. It should be in all caps, red text, with images of blood droplets dripping from the lettering. There should be a pager alert sent to a random project manager every night at 2am containing this text until such time as the issue is resolved. There are no words for how much of a problem this is.

General

  • Did I mention that it doesn't work on mobile?
  • Performance. Across the board. In everything. Rendering reflow. Server-side latency due to reading out repository data. Everything. It's all very very slow compared to the same operations in GitHub.
  • Doesn't support syntax highlighting in Markdown. GitHub flavored Markdown is the standard for this sort of thing.
  • Why does the "Overview" tab exist at all? It shows nothing that the "Source" view doesn't show, and what it does show is of tremendously limited usefulness.
@kpmeen
kpmeen / JodaTimeSerializer.scala
Last active October 7, 2015 21:15 — forked from ctcarrier/gist:9918087
Joda DateTime Serializer for ReactiveMongo
package foo
import reactivemongo.bson.{BSONHandler, BSONDateTime, Macros}
import org.joda.time.format.ISODateTimeFormat
import org.joda.time.{DateTime, DateTimeZone}
package object bar {
DateTimeZone.setDefault(DateTimeZone.UTC)
implicit object BSONDateTimeHandler extends BSONHandler[BSONDateTime, DateTime] {
@kpmeen
kpmeen / typeclass-coproduct.scala
Created May 18, 2016 13:57 — forked from aaronlevin/typeclass-coproduct.scala
Writing a typeclass in Scala that crawls a shapelss Coproduct and returns a new Coproduct
/**
* Let's write a typeclass for a coproduct. The idea is we're given the name of a string, and we need to:
*
* 1. check that the string matches a value
* 2. if the string matches a value, convert that string into some type and return it
* 3. If the string doesn't match that value, try another alternative.
* 4. If no alternatives match the value, return an error.
*
* The usecase is based on something I encountered in real life: we have to parse different kind of events in
* my work's data pipeline, and the type of event (and subsequent parsing) depends on an "event type" string. I
@kpmeen
kpmeen / testspark16.scala
Created June 27, 2016 08:37 — forked from ahoy-jon/testspark16.scala
Spark Datasets Api + Shapeless Tags
package com.cym_iot.training.testspark16
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
import org.apache.spark.sql.{Dataset, Encoder, SQLContext}
import org.apache.spark.{SparkConf, SparkContext}
import shapeless.tag
import shapeless.tag.@@
@kpmeen
kpmeen / IO.scala
Created August 11, 2016 16:39 — forked from jdegoes/IO.scala
A pedagogical implementation of the IO monad in Scala in 14 LOC
case class IO[A](unsafePerformIO: () => A) {
def map[B](ab: A => B): IO[B] = IO(() => ab(unsafePerformIO()))
def flatMap[B](afb: A => IO[B]): IO[B] =IO(() => afb(unsafePerformIO()).unsafePerformIO())
def tryIO(ta: Throwable => A): IO[A] =
IO(() => IO.tryIO(unsafePerformIO()).unsafePerformIO() match {
case Left(t) => ta(t)
case Right(a) => a
})
}
object IO {
#!/usr/bin/env bash
#
set -euo pipefail
unset SBT_OPTS JVM_OPTS JDK_HOME JAVA_HOME
: ${TRAVIS_SCALA_VERSION:=2.11.8}
: ${SBT_TARGET:=$*}
: ${SBT_TARGET:=test}