This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar navigation-group-regex "postnav\\|navigation" | |
"Regular expression to match the class of the navigation container") | |
(defvar prev-link-labels-regex "earlier\\|previous" | |
"Regular expression matching the `previous` link") | |
(defvar next-link-labels-regex "later\\|next" | |
"Regular expression matching the `next` link") | |
(defun my-eww-add-rel-prev-next () | |
"Add rel=\"prev\" and rel=\"next\" attributes to postnav links in EWW." | |
(when (eq major-mode 'eww-mode) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'cl-lib) | |
(defun get-current-file-path (prefix) | |
"Get filesystem from current buffer, provided it's a file buffer. With | |
prefix 4 also append line number. With prefix 16 append column number to | |
everything. Put the resulting string in the kill-ring and also display | |
it int the minibuffer." | |
(interactive "p") | |
(let* ((file-name (buffer-file-name (current-buffer))) | |
(position (when (>= prefix 4) (list ":" (int-to-string (line-number-at-pos))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Stores random state in a structure SB-KERNEL::RANDOM-STATE | |
*random-state* | |
;; Get the actual state vector | |
(sb-kernel::random-state-state *random-state*) | |
;; Intercept the state vector (copying it) | |
(defvar *rs1* (copy-seq (sb-kernel::random-state-state *random-state*))) | |
;; Sample a bunch of random numbers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;; | |
;; Tooltips ;; | |
;;;;;;;;;;;;;; | |
;; TODO: These need polishing and weaving them into the broader | |
;; picture | |
(defun get-point-coordinates () | |
(let* ((posn (posn-at-point)) | |
(abs-pos (posn-x-y posn)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def invert_recursive_dict(d: Dict) -> Dict: | |
""" | |
Assuming `d` is a recursive Dict, invert it by mapping its leaves to the | |
lists/paths of keys leading to them in the original dict. | |
""" | |
def invert(d, path: List, acc: Dict): | |
if isinstance(d, Dict): | |
# Handle dict contents recursively | |
for k, i in d.items(): | |
invert(i, path+[k], acc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- prevent noisy loading of psqlrc file | |
\set QUIET yes | |
--customize prompt | |
\set PROMPT1 '\n%[%033[1;31m%]➤ %[%033[2;37m%]%`\! date "+%F %I:%M %p %Z"`%[%033[0m%] %[%033[1;36m%]%n%@%/%[%033[1;31m%]%x %[%033[K%]%[%033[0m%]\n%[%033[1;33m%]%R%#%[%033[0m%] ' | |
\set PROMPT2 '%[%033[1;33m%]%R%#%[%033[0m%] ' | |
--show timing info for queries | |
\timing | |
-- allow pasting of values to avoid stupid indenting | |
\set paste | |
--get rid of duplicates in history |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; HACK: Teach SLIME about jumping to FiveAM fixture definitions ;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(require 'sb-introspect) | |
(ql:quickload :swank) | |
(ql:quickload :fiveam) | |
;; Poor man's defadvice - stolen from https://gist.github.com/spacebat/46740966846623148c014ab261050bc0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;; | |
;; Paredit ;; | |
;;;;;;;;;;;;; | |
(use-package paredit | |
:ensure t | |
:init | |
:config | |
(show-paren-mode t) | |
;; Workaround for superfluous spaces inserted in e.g. pathnames, as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
**************************** IMPORTANT **************************** | |
This week is a two-step homework. First, you have to solve the | |
"Maze" challenge, and then the "Forest" challenge. The challenges | |
are in two separate files in both the homework and solution, so | |
you can check the solution for the first "Maze" challenge without | |
spoilers of the "Forest" one. Make sure to check the solution for | |
"Maze" (and only "Maze," I see you 🥸👀) before starting with the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add debugging outputs to requests | |
try: | |
import http.client as http_client | |
except ImportError: | |
# Python 2 | |
import httplib as http_client | |
http_client.HTTPConnection.debuglevel = 1 | |
# You must initialize logging, otherwise you'll not see debug output. |
NewerOlder