- “we don’t care about perf”
- “clojure should be fast”
- “we’re using mongo!”
- “clojure might not be fast enough, we should use type hints”
(ns er-model.connectors.kafka.serde | |
(:require | |
[er-model.connectors.kafka.serializers :as k.ser] | |
[er-model.connectors.kafka.deserializers :as k.deser]) | |
(:import | |
[org.apache.kafka.common.serialization | |
Serde | |
Serdes | |
Serdes$StringSerde | |
Serdes$WrapperSerde])) |
(ns er-model.connectors.kafka.serializers | |
(:import (org.apache.kafka.common.serialization | |
LongSerializer | |
Serializer | |
IntegerSerializer | |
StringSerializer | |
ByteArraySerializer) | |
(java.io ByteArrayOutputStream))) | |
;; from https://github.com/ymilky/franzy/blob/master/src/franzy/serialization/serializers.clj |
(ns er-model.connectors.kafka.deserializers | |
(:require | |
[clojure.edn :as edn]) | |
(:import | |
[org.apache.kafka.common.serialization | |
Deserializer | |
StringDeserializer | |
LongDeserializer | |
IntegerDeserializer | |
ByteArrayDeserializer] |
(a/go-loop [async-tcp-connections-to-chans ; "foreign" -> ch | |
buffered ; ch -> data | |
pressurized] ; ch -> foreign | |
(let [cnx (select (keys async-tcp-connections-to-chans)) | |
ch (async-tcp-connections-to-chans cnx) | |
data (read-data cnx) | |
async-tcp-connections-to-chans (dissoc async-tcp-connections-to-chans cnx) | |
buffered (assoc buffered ch data) | |
pressurized (assoc pressurized ch cnx)] | |
Date: [[Date of Document]] Between [Our Company] and [Your Company]
We’re not big on formality, but sometimes it’s best to have a few simple things written down so that we’re all on the same page. In this contract you won’t find complicated legal terms or large passages of unreadable text. We have no desire to trick you into signing something that you might later regret. We do want what’s best for the safety of both parties, now and in the future.
#!/usr/bin/env ruby | |
#/ Usage: <progname> [options]... | |
#/ How does this script make my life easier? | |
# ** Tip: use #/ lines to define the --help usage message. | |
$stderr.sync = true | |
require 'optparse' | |
# default options | |
flag = false | |
option = "default value" |
# The IP Address Validator accepts the following options | |
# | |
# * allow_nil - allows nil values | |
# * allow_blank - allows blank values | |
# * allow_cidr - allows /prefixlen CIDR masks in values | |
# | |
# the validator will use regular expressions in an attempt to prevent | |
# malformed IP addresses from being passed to the IPAddr.new initializer | |
# as this method can be very slow to raise exceptions for malformed input. | |
class IpAddressValidator < ActiveModel::EachValidator |
I spent a lot of time trying to find a pretty optimal (for me) setup for Clojure… at the same time I was trying to dive in and learn it. This is never optimal; you shouldn't be fighting the environment while trying to learn something.
I feel like I went through a lot of pain searching Google, StackOverflow, blogs, and other sites for random tidbits of information and instructions.
This is a comprehensive "what I learned and what I ended up doing" that will hopefully be of use to others and act as a journal for myself if I ever have to do it again. I want to be very step-by-step and explain what's happening (and why) at each step.
I appreciate the effort you've put into documenting this, but there are a number of inaccuracies here that need to be addressed. We get
<!-- layout file --> | |
<% if current_user %> | |
Welcome <%= current_user.username %>. Not you? <%= link_to "Log out", logout_path %> | |
<% else %> | |
<%= link_to "Sign up", signup_path %> or <%= link_to "log in", login_path %>. | |
<% end %> |