Skip to content

Instantly share code, notes, and snippets.

This is an excerpt from an internal discussion at Park Assist on 2016-07-08:

Me:

April and I are pairing up on an effort to… and we felt that we should use a system to track the work, but we were loath to use JIRA. So we’re trying out Clubhouse. I’m going to send everyone an invite; feel free to poke around, try it out, etc.

Ilan Goodman:

On my first pass, it seems very similar to JIRA right out of the box. Can you elaborate on what you dislike about JIRA and why Clubhouse might be better?

@aviflax
aviflax / image_diff.clj
Created October 26, 2018 18:43
Image Diffing with Clojure
(ns image-diff
"Most of this is ported from https://rosettacode.org/wiki/Percentage_difference_between_images#Java"
(:import [java.awt Color]
[java.awt.image BufferedImage]))
(defn pixel-diff
[a b]
(let [a-color-components (.getRGBColorComponents (Color. a) nil)
b-color-components (.getRGBColorComponents (Color. b) nil)]
(->> (map - a-color-components b-color-components)
This works from bash but I haven’t managed to get it to work from within a profile in a deps.edn file:
clojure -Sdeps "{:deps {jonase/kibit {:mvn/version \"0.1.6\"}}}" -e "(require '[kibit.driver :as k]) (k/external-run [\"src\"] nil)"

Testing

Test Runners

Linting

  • kibit is a static code analyzer for Clojure, ClojureScript, cljx and other Clojure variants. It uses core.logic to search for patterns of code that could be rewritten with a more idiomatic function or macro.
  • Eastwood is a Clojure lint tool that uses the tools.analyzer and tools.analyzer.jvm libraries to inspect namespaces and report possible problems.
FROM openjdk:8-alpine
LABEL maintainer="Avi Flax <avi.flax@fundingcircle.com>"
WORKDIR /tmp
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk add --update --no-cache bash curl rlwrap@testing
RUN curl -O https://download.clojure.org/install/linux-install-1.9.0.315.sh
RUN chmod +x linux-install-1.9.0.315.sh
RUN ./linux-install-1.9.0.315.sh
@aviflax
aviflax / query.graphql
Last active December 19, 2017 20:52
Get most recent committers from all repos of a GitHub org
query RecentCommitters($org: String!) {
organization(login: $org) {
name
repositories(first: 100) {
edges {
node {
name
defaultBranchRef {
target {
... on Commit {
Originally sent in a Twitter DM to Robin Biljani.
----
Glad Irma wasn’t too catastrophic for you!
I have similar feelings about Funding Circle, the technologies they’re using, social lending platforms, and the team at Park Assist 👍
OK so, that scenario sounds suspiciously like the “classic” microservice architecture. So it would be… understandable to see this as reasonable simply because it’s fairly common. The logic is something like: this seems to be working for various high-profile orgs, so why not for us? Which is understandable.
# Super CORS for NGINX
# NOT YET TESTED
# Based on https://enable-cors.org/server_nginx.html
# which was based on https://michielkalkman.com/snippets/nginx-cors-open-configuration/
location / {
# preflight
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' "$http_origin"; # wildcard wouldn’t work with Access-Control-Allow-Credentials
add_header 'Access-Control-Allow-Credentials' 'true';
@aviflax
aviflax / Classloading Error with Kotlin and Streams
Last active September 8, 2017 20:15
Classloading Error with Kotlin and Streams
$ kotlinc -cp kafka-streams-0.11.0.0-cp1.jar:kafka-clients-0.11.0.0-cp1.jar:slf4j-api-1.7.25.jar -jvm-target 1.8
Welcome to Kotlin version 1.1.4-3 (JRE 1.8.0_141-b15)
Type :help for help, :quit for quit
>>> import org.apache.kafka.streams.StreamsConfig
>>> val config = hashMapOf("application.id" to "t2p.normalizer", "bootstrap.servers" to "localhost:9092")
>>> StreamsConfig(config)
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.lang.ExceptionInInitializerError
$ npm install -g bower
npm WARN deprecated bower@1.8.0: ..psst! While Bower is maintained, we recommend Yarn and
Webpack for *new* front-end projects! Yarn's advantage is security and reliability, and
Webpack's is support for both CommonJS and AMD projects. Currently there's no migration
path, but please help to create it: https://github.com/bower/bower/issues/2467