Skip to content

Instantly share code, notes, and snippets.

View dmarticus's full-sized avatar
🛠️
mostly elsewhere these days

Dylan Martin dmarticus

🛠️
mostly elsewhere these days
View GitHub Profile
@dmarticus
dmarticus / minimal.zsh-theme
Last active January 6, 2021 00:37
Minimal ZSH theme with a hack that adds the nix_shell status to your prompt
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[white]%}]%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN="]%{$reset_color%} "
ZSH_THEME_SVN_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX
ZSH_THEME_SVN_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX
ZSH_THEME_SVN_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY
ZSH_THEME_SVN_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN
ZSH_THEME_HG_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX
ZSH_THEME_HG_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX
@dmarticus
dmarticus / remove.js
Created October 16, 2020 21:17
remove grailed items from closet
[... document.querySelectorAll('#fittingroom > div:nth-child(2) > div.fitting-room-wrapper.feed > div')].filter(item => item.innerText.includes("Sold")).map(filtered => filtered.childNodes[1].childNodes[2].click());
@dmarticus
dmarticus / scroll.js
Last active October 16, 2020 21:18
infinite scrolls the grailed closet to the end of it all
var lastScrollHeight=0;function autoScroll(){var l=document.documentElement.scrollHeight;l!=lastScrollHeight&&(lastScrollHeight=l,document.documentElement.scrollTop=l)}window.setInterval(autoScroll,100);
document.getElementById('gateway-content').remove(); document.getElementById('app').children[0].children[0].classList = [];
import java.io._
import java.nio.charset.CharacterCodingException
import cats.{ ApplicativeError, Defer, MonadError }
import cats.effect._
import cats.implicits._
import com.typesafe.scalalogging.LazyLogging
import scala.concurrent.duration._
@dmarticus
dmarticus / PomToSBT.sh
Last active April 12, 2020 05:27
Convert POM dependencies to SBT dependencies using the ammonite REPL. Useful when trying to migrate a project from maven to SBT.
#!/usr/bin/env amm
// This script converts Maven dependencies from a pom.xml to sbt dependencies.
// It is based on the answers of George Pligor and Mike Slinn on http://stackoverflow.com/questions/15430346/
// - install https://github.com/lihaoyi/Ammonite
// - make this script executable: chmod +x PomDependenciesToSbt
// - run it with from your shell (e.g bash):
// $ ./PomDependenciesToSbt /path/to/pom.xml
import scala.xml._
import $ivy.`org.typelevel::cats-core:2.1.1`, cats._, cats.implicits._
import $ivy.`org.scalatest::scalatest:3.0.8`,org.scalatest._
import $ivy.`org.scalacheck::scalacheck:1.14.0`
import $ivy.`io.monix::monix:3.1.0`
import $ivy.`dev.zio::zio:1.0.0-RC18`
import $ivy.`org.typelevel::cats-effect:2.1.2`
import $ivy.`com.github.chocpanda::scalacheck-magnolia:0.3.1`
import $ivy.`io.chrisdavenport::cats-scalacheck:0.2.0`
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
@dmarticus
dmarticus / functional_programming_with_scala.md
Last active October 15, 2019 21:34
Functional Programming Techniques using Scala

Functional Programming features in Scala

I've been exploring functional programming with Scala ever since I started on the Digital Experience Platform team at Qualtrics (my first ever exposure to Scala), and ever since I grokked functional programming I really got excited about the concept and have since been trying to learn and apply its principals to the code I write.

This post spawned out of notes that I've taken about the language in my first 6 months working in it, and I decided to clean it up last night in the hope that my attempts to learn functional programming in Scala help with anyone else who is curious. It was also helpful for my own learning to write everything down.

Anyway, here's what I have so far!

Higher Order functions