This morning I was playing around and decided to try and recreate an example from Structure and Interpretation of Computer Programs (SICP). Along the way I discovered some unexpected gotchas with how Python scopes closures. The example I was trying to reproduce was the following one: (define (make-account balance) (define (withdraw amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insufficient funds")) (define (deposit amount) (set! balance (+ balance amount)) balance) (define (dispatch m) (cond ((eq? m 'withdraw) withdraw)…
I’ve recently gotten into doing a lot of lisp programming in emacs, and rainbow-delimiters-mode is a huge help in terms of visually finding your way around. What I wasn’t thrilled with, however, was the default color scheme which is rather bland. So I decided to spice it up. So here’s some better defaults for rainbow delimiters mode: (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;;…
Hey you! Tired of having type all this nonsense just to push up the current git branch?: $ git push origin my-super-long-branch-name Well fear not, just add this simple git alias to push the current branch: pu = !git branch | grep '^\\*' | cut -c3- | xargs git push origin And then just type: $ git pu EDIT: Little did I know there’s a much easier equivalent command $ git push origin HEAD