Skip to content

Instantly share code, notes, and snippets.

@kidd
Last active April 18, 2024 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kidd/3792e52875fd3afbf539c51122ec8352 to your computer and use it in GitHub Desktop.
Save kidd/3792e52875fd3afbf539c51122ec8352 to your computer and use it in GitHub Desktop.
advice browse-url-at-point to account for stripe ids
;;; (keymap-global-set "C-c o" 'browse-url-at-point)
(defun rgc/add-stripe (args)
"prepend the right stripe path to be able to find the entity
you're looking for"
(let* ((arg (s-replace-regexp "^https?://" "" (car args)))
(path
(cond
((s-match "^price_.*" arg) "prices")
((s-match "^sub_.*" arg) "subscriptions")
((s-match "^prod_.*" arg) "products")
((s-match "^cus_.*" arg) "customers"))))
(if path
(cons (concat "https://dashboard.stripe.com/test/" path "/" arg)
nil)
args)))
(advice-add 'browse-url :filter-args #'rgc/add-stripe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment