Skip to content

Instantly share code, notes, and snippets.

I've been working with Apache Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥

Get the tools

@mfikes
mfikes / lein-tools-deps-cursive.md
Last active October 31, 2020 12:35
Using `lein-tools-deps` from Cursive (on macOS)

Note: These workarounds covered issues in lein-tools-deps 0.3.0-SNAPSHOT. If using 0.4.1 or later, you should not encounter the issues below.

The following provides some workarounds for some issues when using lein-tools-deps from Cursive on macOS.

Path to clojure

By default, the lein-tools-deps plugin won't see /usr/local/bin/clojure when Cursive processes project.clj, as it evidently has a degenerate path.

You will see an error like the following in the IntelliJ Event Log when it tries to process your project.clj file:

@thegeez
thegeez / spec_parsing.clj
Last active December 30, 2023 18:17
Parsing with clojure.spec for the Advent of Code challenge
(ns net.thegeez.advent.spec-parsing
(:require [clojure.string :as str]
[clojure.spec :as s]
[clojure.spec.gen :as gen]
[clojure.test.check.generators :as tgen]))
;; Dependencies:
;; [org.clojure/clojure "1.9.0-alpha14"]
;; [org.clojure/test.check "0.9.0"]
;; Advent of Code is a series of code challenges in the form of an advent

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@cszentkiralyi
cszentkiralyi / vim-sexp-cheatsheet.md
Last active November 10, 2023 10:05
vim-sexp cheatsheet

Prereqs

These are for the combined vim-sexp (https://github.com/guns/vim-sexp) and vim-sexp-mappings-for-regular-people (https://github.com/tpope/vim-sexp-mappings-for-regular-people) plugins. vim-sexp is neat on its own but Tim Pope makes common stuff much easier.

Note that some vim-sexp functionality depends on <LocalLeader> mappings. This is a different leader key than the global leader, and is the variable maplocalleader (instead of mapleader). To see if you have this set, use :echo maplocalleader; if it errors out you'll need to set it, otherwise it will echo the key. If you want to set your LocalLeader to <Space>, you'll need two commands in your .vimrc, since by default <Space> is bound to <Right> in normal mode:

nnoremap <Space> <Nop>
let maplocalleader=" "

TOC

@zchee
zchee / actionlist.vim
Last active April 19, 2024 13:22
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing
module Mongoid
module Document
def instantiate(attrs = nil, criteria_instance_id = nil)
attributes = attrs || {}
doc = allocate
doc.criteria_instance_id = criteria_instance_id
doc.instance_variable_set(:@attributes, attributes)
doc.apply_defaults
IdentityMap.set(doc) if identity_map_set_possible?(criteria_instance_id)
doc.run_callbacks(:initialize) unless doc._initialize_callbacks.empty?
@alexbevi
alexbevi / pre-commit.sh
Created August 23, 2012 12:05
Git pre-commit hook that checks ruby source files for Pry breakpoints
# Git pre-commit hook to check all staged Ruby (*.rb/haml/coffee) files
# for Pry binding references
#
# Installation
#
# ln -s /path/to/pre-commit.sh /path/to/project/.git/hooks/pre-commit
#
# Based on
#
# http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/