Skip to content

Instantly share code, notes, and snippets.

View dvliman's full-sized avatar

David Liman dvliman

View GitHub Profile
// src/main/resources/application.properties
demo.db.url = jdbc:postgresql://localhost/demo
// src/main/kotlin/com/dvliman/demo/Beans.kt
package com.dvliman.demo
import org.davidmoten.rx.jdbc.Database
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
class Beans {
// build.gradle
dependencies {
implementation 'com.github.davidmoten:rxjava2-jdbc:0.2.2'
implementation 'org.postgresql:postgresql:42.2.5'
}
// src/main/kotlin/com/dvliman/demo/Config.kt
package com.dvliman.demo;
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Component
@Component
class Config {
INSERT INTO users (name, email) VALUES ('some-name', 'some-email');
SELECT * FROM users;
SELECT user_id, name, email FROM users WHERE user_id = '1';
-- setup.sql
CREATE DATABASE demo;
CREATE TABLE users (
user_id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL UNIQUE
);
package com.guardtime.amgenlink
import com.sun.org.apache.xerces.internal.dom.DOMInputImpl
import com.sun.org.apache.xerces.internal.impl.xs.XSComplexTypeDecl
import com.sun.org.apache.xerces.internal.impl.xs.XSImplementationImpl
import com.sun.org.apache.xerces.internal.impl.xs.XSModelGroupImpl
import com.sun.org.apache.xerces.internal.impl.xs.XSParticleDecl
import com.sun.org.apache.xerces.internal.xs.*
import org.w3c.dom.bootstrap.DOMImplementationRegistry
import org.w3c.dom.ls.LSInput
@dvliman
dvliman / pipejine.clj
Created July 2, 2018 07:21
pipejine-core
(ns pipejine.core
(:require [clojure.tools.logging :as log]
[clojure.stacktrace :as st])
(:import [java.util.concurrent LinkedBlockingQueue CountDownLatch TimeUnit]
[org.slf4j MDC]))
(defn new-queue
"Create and initialize a new queue"
[{:keys [name queue-size number-of-consumer-threads number-of-producers partition time-out]
:or {name (gensym name), queue-size 1, number-of-consumer-threads 1,
@dvliman
dvliman / async_util.clj
Created July 2, 2018 06:52 — forked from echeran/async_util.clj
Utility functions for core.async 0.1.346.0-17112a-alpha to create a linear pipeline of go-routines in a Storm-esque way.
(ns your.namespace.async-util
(:require
[clojure.core.async :as a :refer [>! <! >!! <!! go chan buffer
close! thread alts! alts!! timeout]]
[clojure.core.match :as match :refer [match]]))
;;
;; core.async util fns
;;
{
"id": "3f5d6a4e-c284-4f78-bfdf-7669b45af907",
"name": "Uber",
"legalName": "Uber Technologies, Inc.",
"domain": "uber.com",
"domainAliases": [
"uber.org",
"ubercab.com"
],
"site": {