• Useful Emacs/Evil Keybindings

    I am a big fan of Emacs. In particular, I use the Spacemacs pre-configuration. However, one thing that bugged me about the defaults is that C-h and C-w don’t map to backspace and backward-word-kill (respectively). One thing I tried was the following:

    (global-set-key "\C-h" 'backward-delete-char)
    (global-set-key "\C-w" 'evil-delete-backward-word)

    Note that I use evil-delete-backward-word rather than the usual backward-word-kill, as (for my purposes) they are equivalent.

    But this misses a few modes, in particular in helm and isearch modes. As a result, I have accumulated a list of these additional modes that need these keybinds.

    Here is the full list. Hopefully, it is useful to you if you came across this article:

    (global-set-key "\C-h" 'backward-delete-char)
    (global-set-key "\C-w" 'evil-delete-backward-word)
    (define-key helm-map "\C-h" 'delete-backward-char)
    (define-key helm-map "\C-w" 'evil-delete-backward-word)
    (define-key helm-find-files-map "\C-w" 'evil-delete-backward-word)
    (define-key iedit-mode-keymap "\C-h" 'backward-delete-char)
    (define-key iedit-mode-occurrence-keymap "\C-h" 'backward-delete-char)
    (define-key isearch-mode-map "\C-h" 'backward-delete-char)
    (define-key isearch-mode-map "\C-w" 'evil-delete-backward-word)

  • Highest Normalized P/E Ratios on the S&P 500

    I wrote a quick script to find the highest (and lowest — email me at daniel@danieljaouendevelopment.com if you’d like a list of those) yearly normalized P/E ratios on the S&P 500. Here are the highest:

    • TWTR (147.99)
    • WELL (171.18)
    • DXCM (174.45)
    • TSLA (178.96)
    • VTRS (186.63)
    • MGM (203.88)
    • UDR (222.29)
    • ENPH (229.87)
    • PPL (397.02)
    • NOW (406.76)

    If you found this information useful, feel free to support me on Buy Me a Coffee. Your support goes to offset the cost of running this site and never goes unappreciated.

    Thanks for reading!

  • The Why of Elixir

    Learning a new language (and a new paradigm: functional programming) can be a lot to take on. That’s why I thought I’d write a short post on why learning Elixir would be a valuable use of your time. In particular, I will go over the various strengths that the Elixir ecosystem has as well as some major benefits. Let’s start with reliability.

    Reliability

    I was recently watching a video by Jonathan Blow (the game developer) and he mentioned how there used to be a concept in tech called “five nines”. What that meant was that a particular service would be “available” (for some definition of the word) 99.999% of the time. Elixir can help you to achieve these numbers using something in the language known as “supervision trees”. Basically what this means is that, if Elixir encounters some error situation, it can simply crash the process and expect the process’s supervisor to either restart the process or handle the crash in an appropriate way. This means that, effectively, if you program things correctly, your application will have very little “downtime”. As you can imagine, this does wonders for your app and is a big reason to learn and use Elixir.

    Next, let’s look at parallelization.

    Parallelization

    If you are coming over from Javascript, you might already be familiar with asynchronous programming using Promises. Elixir takes a different approach to parallelization: it uses lightweight processes which can send messages to each other. Basically what this means is that any time you want to start something in the background, you can spawn up a process and send it any message you want. The flip side of this is that the process can also send (asynchronous) messages back to the calling process. What this effectively means is that you can write your code synchronously, then split out the necessary bits into its own process. This makes it easy to both read and write Elixir programs that utilize multiple cores of your machine without the added hassle of callbacks or promises.

    Next, let’s look at extensibility.

    Extensibility

    If you’ve programmed in a Lisp (or a C derivative) before, you may be familiar with the concept of a macro. A macro is essentially code that writes code. The reason I mentioned Lisp is that Elixir, though it can look similar to Ruby, actually makes use of macros internally. Essentially, Elixir code only looks like Ruby because it uses some syntactic sugar to hide its Lisp-like structures. I won’t go into too much detail here, but if you are really curious about this aspect of Elixir, I would give Chris McCord’s book, “Metaprogramming Elixir” a read.

    Next, let’s get to the probable reason you are reading this arcticle: Elixir helps you to minimize the amount of Javascript you have to write.

    No Need To Write Javascript (TM)

    I would be remiss if I were to write an article about Elixir without mentioning Phoenix and LiveView. Phoenix is basically a Rails- or Django-like web framework written in Elixir. If you’re not familiar with web frameworks, they are a bit too complicated to go into in detail here, but I will just say that they help you to write and organize code meant for serving browsers web pages. What really piqued my interest when learning Elixir was that Phoenix has an addon called LiveView which lets you write interactive pages without the use of Javascript. Basically, all you do is write Elixir code that handles events on the page, and you’re good to go!

    Conclusion

    So those are some of the benefits of learning and using Elixir. If you enjoyed this post, feel free to Buy Me a Coffee. Your support helps to offset the cost of running this site and never goes unappreciated.

    Thanks for reading!

  • Hello, World!

    Hello, world!

    SELECT title FROM future_posts WHERE author = ‘daniel@danieljaouendevelopment.com’;

    • itertools and functools in Python
    • The Why of Elixir
    • A Brief Introduction to Phoenix and LiveView

    Plus various other webdev, Linux, and command line lifestyle topics!

    Please enjoy your stay!