Skip to content

Instantly share code, notes, and snippets.

@ajvargo
ajvargo / failure_formatter.rb
Created March 1, 2023 15:53
RSpec failure formatter
# It will cycle N dots for progress.
# Failures are printed immediately in detail.
class FailureFormatter
RSpec::Core::Formatters.register self, :example_passed, :example_failed, :dump_summary, :start_dump, :example_pending
@@dot_count = 0
N = 10
attr_reader :output
@ajvargo
ajvargo / failure_formatter.rb
Created December 30, 2021 17:26
Custom RSpec formatter
# I don't like a lot of noise when my specs run.
# This will print the characters from 'progress', but clears the line every 10 so you don't get an epic line of dots.
#
# Any failures are printed as you go, so I can start looking while the the tests finish.
#
# You can simplify this with your .rspec-local file.
# rspec --require path/to/failure_formatter.rb -- format FailureFormatter spec
class FailureFormatter
@ajvargo
ajvargo / looky-loo.el
Created August 5, 2021 15:50
Emacs helper to start aspects of my dev environment.
;;; These commands need to be executed when you are in the context of a nix-project.
;;; Requirements:
;; - direnv (shell and emacs)
;; - projectile (emacs)
(defun av-project-buffer-name-function (proc-name)
"Generate a buffer name based on `PROC-NAME'.
The name looks like '**<nix project> `PROC-NAME'**', **lello overmind**"
`(lambda (_mode-name)
@ajvargo
ajvargo / input_example.el
Created January 20, 2013 03:56
An example of getting user input for an Elisp function with a default value divined from context.
(defun input-example (text)
"Gets user input and prints it back. Defaults to word at point"
(interactive
(list
(read-string
(format "Text (%s): " (word-at-point)) ; prompt. It's nice to show the default value
nil ; initial input. This value is prefilled in the mini-buffer. Available but considered deprecated.
nil ; history list if you have a specific one for this
(word-at-point) ; Whatever this evaluates to will be the default value
)))
@ajvargo
ajvargo / code-pipeline-watch-mode.el
Last active February 28, 2020 17:55
First solid pass at getting code pipeline work flow updates in emacs.
;;; codepipeline-watch-mode.el --- Watch the progress of AWS Codepipeline Builds -*- lexical-binding: t; -*-
;;; Commentary:
;; Shells out to `aws` command line to get data for display.
;; My theme is dark. No idea how these colors look in a light theme.
;; M-x codepipeline-watch-get-status
;; `g` will refresh - it'll update on its own now and then.
;;; Code:
@ajvargo
ajvargo / rspec-with-nix.el
Created November 22, 2019 17:38
Setup rspec mode so it works with nix and direnv (in emacs)
;;; 0 - install `direnv' on your machine and active it for lello
;;; `cd lello && direnv allow'
;;; 1 - Install `rspec-mode' and configure
;; allows the test finder to not choke on `lib' stuff
(setq rspec-primary-source-dirs '("app"))
@ajvargo
ajvargo / bike.org
Created October 4, 2019 17:06
Thoughts on bike gear

Recommended bike gear

Bike pump

A bikepump is something you want to spend on if you can. It’ll really make a difference. Even on the trainer, should should be putting air in your tires every week or 2. When you start riding outside, you want it a minimum of once a week. Honestly, I’d say make it part of your pre-ride setup.

@ajvargo
ajvargo / auto-complete.org
Created April 22, 2019 17:28
Files for autocomplete talk

Goal

  • Introduce bash completion
  • look at basic options
  • build a custom completion

What’s out there

complete -p
@ajvargo
ajvargo / org-trello.el
Created March 28, 2019 18:06
Extension to allow pulling trello cards into org
;;; the functions of interest are
;;; org-trello-insert-todo
;;; takes the card - like 'JgW7pEMn'
;;; org-trello-insert-todo-from-url
;;; takes a full trello url and pulls the card out
;; For key & token, go to https://trello.com/app-key The key should be
;; front and center. For the token, follow the 'Token' link in the
;; first paragraph and then 'Allow'
(defvar org-trello-key "....")
# uses xpath to check for a form element based on the label,
# instead of using a css selector w/ label_for
# name should be the complete name in the html page.
# meaning Title: and not Title
# find the label that is name. Get the "for" of the label
# uses the for to check for the input with that as an id
Then /^I should see a "([^\"]*)" for "([^\"]*)"$/ do |type, name|
case type