Skip to content

Instantly share code, notes, and snippets.

@worace
worace / hotload.markdown
Created December 4, 2015 21:31
Hotloading Dependencies in Leiningen with refactor-nrepl

Hotloading Deps in Lein

Refactor nrepl makes it possible to hotload a dependency into lein without rebooting the repl. This is awesome but it's not super well documented.

First, make sure you have the plugin installed by adding it to the :plugins key of your lein profile. This can be done per project in project.clj, but is probably best to include in your ~/.lein/profiles.clj

Here's an example:

csv2json () {
ruby -r csv -r json -e 'CSV.new(STDIN, headers: true).each { |r| puts r.to_h.to_json }'
}
@worace
worace / example.scala
Created August 27, 2021 21:45
Cats Effect Cancellation Testing
import cats.effect.Clock
import cats.effect.{IOApp, Resource, IO, ResourceApp, ExitCode}
import scala.concurrent.duration._
object Dummy extends IOApp {
val resource = Resource.make(IO(System.currentTimeMillis)){ start =>
IO.sleep(3.seconds) >> IO.println(s"Exiting -- ${System.currentTimeMillis - start}")
}
def run(args: List[String]) = resource.use { ctx =>
val interruptible = IO.never
@worace
worace / week_3.markdown
Created May 26, 2016 14:40
Module 1 Week 3 Diagnostic

Module 1 Week 3 Diagnostic

This exercise is intended to help you assess your progress with the concepts and techniques we've covered during the week.

For these questions, write a short snippet of code that meets the requirement. In cases where the question mentions a "given" data value, use the variable given to refer to it (instead of re-writing the information).

@worace
worace / with_stringified_values.sql
Created April 18, 2021 17:14
stringify non-string values in jsonb
-- migrate:up
CREATE OR REPLACE FUNCTION with_stringified_values(input jsonb)
RETURNS jsonb
LANGUAGE plpgsql AS
$func$
DECLARE
_key text;
_value text;
_vals text[] := '{}'::text[];
_output jsonb := '{}'::jsonb;
@worace
worace / apache-spark.rb
Created February 7, 2020 00:13 — forked from eddies/apache-spark.rb
Apache Spark 2.2.0 Homebrew
class ApacheSpark < Formula
desc "Engine for large-scale data processing"
homepage "https://spark.apache.org/"
url "https://archive.apache.org/dist/spark/spark-2.2.0/spark-2.2.0-bin-hadoop2.7.tgz"
version "2.2.0"
sha256 "97fd2cc58e08975d9c4e4ffa8d7f8012c0ac2792bcd9945ce2a561cf937aebcc"
head "https://github.com/apache/spark.git"
bottle :unneeded
@worace
worace / fixed_ish.geojson
Last active January 26, 2020 18:34
PostGIS tutorial red hook neighborhood example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Geoq - (yet another) GIS command line tool

  • Problem - ad-hoc manipulation + inspection of piles of textual GIS data
  • Replacing copy-paste workflows
  • Most work is already in the terminal, so unix tools are a plus
    • integrate with other tools
    • streaming enables processing large datasets
    • fast startup + executable binaries are nice
    • Easy, cross-platform install (rust)
  • README - https://github.com/worace/geoq
@worace
worace / rubric.markdown
Created August 31, 2015 18:40
JS Linked list rubric

JS Linked List Rubric

1. Functional Expectations

  • 4: Application fulfills all base expectations as well as 1 or more of the remove_by/find_by index/value functions
  • 3: Application fulfills all base expectations
  • 2: Application is missing one base expectation
  • 1: Application is missing more than one base expectation

2. Test-Driven Development