Skip to content

Instantly share code, notes, and snippets.

View aaronjensen's full-sized avatar

Aaron Jensen aaronjensen

View GitHub Profile
@aaronjensen
aaronjensen / drain_stop.ex
Last active November 28, 2022 06:59
Phoenix Drain Stop
# ATTENTION: This is now supported in plug_cowboy as of 2.1.0:
# https://hexdocs.pm/plug_cowboy/Plug.Cowboy.Drainer.html
defmodule DrainStop do
@moduledoc """
DrainStop Attempts to gracefully shutdown an endpoint when a normal shutdown
occurs. It first shuts down the acceptor, ensuring that no new requests can be
made. It then waits for all pending requests to complete. If the timeout
expires before this happens, it stops waiting, allowing the supervision tree
to continue its shutdown order.
defmodule Executable do
@moduledoc """
Executables are either commands or queries.
They should declare a struct that dictates the shape and defaults of their
parameters and a `handle_execute/1` function that takes that struct and does
something in response.
"""
use Behaviour
@aaronjensen
aaronjensen / company-complete-cycle.el
Last active May 25, 2021 21:11
Enables tab to complete and cycle completions with company-mode, similar to neocomplete in vim
;; Modify company so that tab and S-tab cycle through completions without
;; needing to hit enter.
(defvar-local company-simple-complete--previous-prefix nil)
(defvar-local company-simple-complete--before-complete-point nil)
(defun company-simple-complete-frontend (command)
(when (or (eq command 'show)
(and (eq command 'update)
(not (equal company-prefix company-simple-complete--previous-prefix))))
@aaronjensen
aaronjensen / zod-circular-dependency-branch.js
Last active December 1, 2020 18:53
Zod with experimental rollup circular dependency resolution
import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './common/_commonjsHelpers-c6a44736.js';
var cjs = {exports: {}};
var string = {exports: {}};
var base = {exports: {}};
var parser = {exports: {}};
(defvar aj--eager-features nil)
(setq aj--initial-feature-count (length features))
(setq aj--eager-features-path (no-littering-expand-var-file-name "eager-features"))
(defun aj/load-eager-features ()
(while (and aj--eager-features
(not (input-pending-p)))
(unwind-protect
(require (pop aj--eager-features) nil t)))
@aaronjensen
aaronjensen / init.el
Last active May 7, 2019 21:54
doom modeline for spacemacs
# Add to spacemacs-configuration-layers:
# theming
# doom-modeline
# Add to dotspacemacs-excluded-packages
# spaceline
# Set:
# dotspacemacs-mode-line-theme 'vanilla
From a55e5259341e054023727de4dc86b77c7a7d5db6 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Mon, 29 Oct 2018 15:37:35 +0000
Subject: [PATCH v3] Fix more drawing bugs in NS port (bug#32932)
* src/nsterm.m (ns_row_rect): New function.
(ns_clip_to_row): Remove function.
(ns_copy_bits): Fix mistake.
(ns_shift_glyphs_for_insert): Mark the frame as dirty instead of
directly copying.
From 60e87aa179c31ee9045ab0bd473e4b69c3d3f984 Mon Sep 17 00:00:00 2001
From: Aaron Jensen <aaronjensen@gmail.com>
Date: Mon, 19 Nov 2018 18:14:36 -0800
Subject: [PATCH] New drawing
---
src/nsterm.h | 5 +-
src/nsterm.m | 859 +++++++++++++++++++++++++++------------------------
2 files changed, 456 insertions(+), 408 deletions(-)
* src/nsterm.m (ns_row_rect): New function.
(ns_clip_to_row): Remove function.
(ns_copy_bits): Fix mistake.
(ns_draw_fringe_bitmap): Stop using ns_clip_to_row.
(ns_draw_window_cursor): Stop using ns_clip_to_row and perform a
display when not in redisplay.
(ns_update_window_begin): Remove redundant code that never executes.
([EmacsView drawRect:]): Show the rectangle being exposed in NSTRACE.
* src/xdisp.c (expose_window_tree) [HAVE_NS]:
(expose_frame) [HAVE_NS]: Redraw even if the frame is garbaged.
From 9800764c5ea1448d1a4f1bd785e98ad94a940e12 Mon Sep 17 00:00:00 2001
From: Aaron Jensen <aaronjensen@gmail.com>
Date: Mon, 5 Nov 2018 08:09:31 -0800
Subject: [PATCH] Fix
---
src/nsterm.m | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/nsterm.m b/src/nsterm.m