This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Title do | |
@moduledoc """ | |
Build up a title-case function for ensuring that a line is properly cased. | |
""" | |
# Includes articles as well | |
@prepositions ~w(a aboard about above abreast absent across after against ago | |
along aloft alongside amid among an and apropos around as aslant astride at atop | |
before behind below beneath beside besides between beyond but by circa cum | |
despite during except for from in including inside into less like next |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Maintaining Transitive Closure of Graphs in SQL (1999) | |
-- https://corescholar.libraries.wright.edu/knoesis/399/ | |
-- Set up | |
DROP TABLE IF EXISTS graph; | |
DROP TABLE IF EXISTS transitive_closures; | |
CREATE TABLE graph ( | |
x VARCHAR(5) NOT NULL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Maintaining Transitive Closure of Graphs in SQL (1999) | |
-- https://corescholar.libraries.wright.edu/knoesis/399/ | |
-- 2) Transitive Closure of Acyclic Graphs | |
-- Maintenance Under Insertion | |
-- Insertion of edge (a, b). | |
SELECT * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn kebab-snake | |
"Convert a kebab-case keyword to snake_case." | |
[kw] | |
(-> kw name (clojure.string/replace #"-" "_") keyword)) | |
(defn snake-kebab | |
"Convert a snake_case keyword to kebab-case." | |
[kw] | |
(-> kw name (clojure.string/replace #"_" "-") keyword)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:deps | |
{org.jsoup/jsoup {:mvn/version "1.11.2"}}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmethod print-method java.time.LocalDate | |
[v ^java.io.Writer w] | |
(.write w "#date \"") | |
(.write w (.format v java.time.format.DateTimeFormatter/ISO_LOCAL_DATE)) | |
(.write w "\"")) | |
(java.time.LocalDate/now) | |
(defn format-instant | |
[v ^java.io.Writer w] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.tools.namespace.move :as move]) | |
(move/move-ns | |
'proj.old.loc | |
'proj.new.shiny.loc | |
"src" | |
["src" "test"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Attempting to access an SQLite DB from Loom. | |
;; SQLite3 is installed and npm installed. | |
(def sqlite (js/require "sqlite3")) | |
(defn on-error [err] | |
(when err | |
(js/console.error err.message))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.Future | |
import java.util.concurrent.atomic.AtomicReference | |
import org.apache.kafka.clients.producer.{Callback, KafkaProducer, ProducerRecord, RecordMetadata} | |
import scala.collection.JavaConversions._ | |
/** This construct allows for a KafkaPublisher to be reused in an executor. | |
* | |
* Establishing communication to the Kafka cluster is expensive, so this should |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.ByteArrayOutputStream | |
import org.apache.avro.Schema | |
import org.apache.avro.io.{BinaryDecoder, BinaryEncoder, DatumReader, DatumWriter, DecoderFactory, EncoderFactory} | |
import org.apache.avro.reflect.{ReflectDatumReader, ReflectDatumWriter} | |
import org.apache.avro.specific.SpecificRecordBase | |
class AvroCodec[A <: SpecificRecordBase](schema: Schema) { | |
val decoderFactory: DecoderFactory = DecoderFactory.get() |
NewerOlder