I hereby claim:
- I am lloydmeta on github.
- I am lloydmeta (https://keybase.io/lloydmeta) on keybase.
- I have a public key ASDV-Q5mo7JtznoCLhHrmY3Dug4Qe9ISTKQDM4bIxOuj-wo
To claim this, I am signing this object:
object PrettyDuration { | |
import scala.concurrent.duration._ | |
def show(duration: Duration): String = { | |
if (Duration.Inf == duration) { | |
"Inf" | |
} else if (Duration.MinusInf == duration) { | |
"MinusInf" | |
} else { | |
duration.toCoarsest.toString | |
} |
import scala.reflect.macros.whitebox | |
import scala.language.experimental.macros | |
trait AnyValAwareMatchers { | |
/** | |
* An `any` matcher implementation macro that is aware of [[AnyVal]] wrapper classes. | |
* | |
* When using it with custom [[AnyVal]] classes, make sure to pass the concrete type. |
@ import $ivy.{`com.chuusai::shapeless:2.3.3`} | |
import shapeless._, ops.hlist.Align, ops.hlist.SelectAll, SelectAll._ | |
class Transform[T] { | |
// The fun stuff. Given an S, returns a T, if S has the right (subset of) fields | |
def apply[S, SR <: HList, TR <: HList](s: S)( | |
implicit | |
genS: LabelledGeneric.Aux[S, SR], |
[alias] | |
retest-commit = commit --allow-empty -m \"Retest - empty commit\" | |
current-remote = !git config branch.`git name-rev --name-only HEAD`.remote | |
current-branch = symbolic-ref --short HEAD | |
refresh-from = !git pull $1 $(git current-branch) && git push && : | |
refresh-master = !git fetch -fu $1 master:master && git push $(git current-remote) master && : |
#[derive(Clone, Copy, Debug, PartialEq, Eq)] | |
pub struct Coords { | |
pub x: i64, | |
pub y: i64, | |
} | |
/// Given an Ulam spiral index, returns the Cartesian coordiantes | |
/// for it. | |
/// | |
/// # Examples |
I hereby claim:
To claim this, I am signing this object:
pub fn combine_all_option<T>(xs: &Vec<T>) -> Option<T> | |
where | |
T: Semigroup + Clone, | |
{ | |
xs.iter().skip(1).fold( | |
xs.first().map(|v| v.clone()), | |
|acc, next| acc.map(|v| v.combine(next)), | |
) | |
} |
import play.api.libs.json._ | |
object NewTypeJsonFormats { | |
/** | |
* Returns a Json Formatter for newtype wrappers | |
* | |
* Adapted from https://groups.google.com/d/msg/play-framework/zDUxEpEOZ6U/-7BpwI8iBCoJ | |
* Usage: NewTypeJsonFormats(UserId.apply)(UserId.unapply) |
#!/usr/bin/env bash | |
docker run -it -e LAMBDA_EXECUTOR="docker" -p 8080:8080 -p 443:443 -p 4567-4582:4567-4582 -p 4590-4593:4590-4593 -v "/private/var/folders/localstack:/tmp/localstack" -v "/var/run/docker.sock:/var/run/docker.sock" -e DOCKER_HOST="unix:///var/run/docker.sock" -e HOST_TMP_FOLDER="/private/var/folders/localstack" "localstack/localstack" |
module BaseChange where | |
import Data.Foldable (foldl') | |
-- Turns a base 10 number into a list representation in another base | |
-- based on the zero and digit representation you pass in | |
-- :: Integral -> zero -> [digits] -> [representation] | |
decToBaseN :: Integral a => a -> b -> [b] -> [b] | |
decToBaseN i zero digits = if base == 0 then [] else go i [] | |
where |