jQuery in 2017
jQuery was THE SHIT like 10 years ago. I wrote my first large Single Page Application using it, and it still played a big role in writing SPA’s using knockout etc for a long time. But the big question is: are there still a place for libraries like jQuery in 2017?
But I do believe that there are many situations where React or Angular is 100% overkill, and a tool like for example jQuery is the right one because you just need to ajax and a few click events.
Should you spend time learning it? I wouldn’t. Learn ES2017, learn React etc. And I think most people will pick up on jQuery very fast, if they need to.
So, I decided to finally write a emacs command to post to Micro.blog.
This is how it works: write what you want to post in a buffer, M-x (space space) post2mb.
Then, open ~/emacs.d/private/mb.el and find the following line :headers ‘((“Authorization” . “Bearer”)), you need to add a app token after Bearer; make sure there is a space between Bearer and your token.
Finally you need to open your spacemacs config: ~/.spacemacs, find the user-config and add the following two lines to it:
Restar emacs an you should be set. Just open a new buffer, start writing and hit SPC SPC post2mb when you’re ready to post.
Android fans, I’m sorry, but I can’t stand material design. It’s not bad, just not for me.
Fixing OpenSSL on High Sierra
I was coding some Chicken Scheme during the weekend and had some serious problems getting OpenSSL to work properly. This is probably the first time I’ve had to compile anything from source by hand in years.
The problem was that most of the stuff I use from day to day have migrated to use LibreSSL on OS X, while the Chicken Scheme eggs I was using hasn’t. Apple have moved over to Libre, and Homebrew have stopped to let me link OpenSSL, because of compability reasons. Or I do at least assume so.
I followed the steps on this StackOverflow https://stackoverflow.com/questions/38670295/homebrew-refusing-to-link-openssl thread to fix it
Run this if it doesn’t exist:
cd /usr/local && mkdir src && chown USER src && cd src
curl –remote-name https://www.openssl.org/source/openssl-1.0.2h.tar.gz
tar -xzvf openssl-1.0.2h.tar.gz
./configure darwin64-x86_64-cc –prefix=/usr/local/openssl-1.0.2h shared
sudo make install
ln -s /usr/local/openssl-1.0.2h/bin/openssl /usr/local/bin/openssl
And, if you need to install the openssl egg (or any other SSL lib) run the following commands:
Looping without loops.
As a coder or a apiring one you have probably experienced many moments where all the smokes blows away and you understand something much clearer. One of these moments for me was when I was introduced to recoursion. Probably, while learning Scheme or Haskell. The basic idea is that a function calls itself. Don’t use recoursion when you write definitions, because circularity is BAD philosophy.
Here is a very simple example that loops over an array, and prints the result, without using a regular loop; like while, for, do, map, forEach etc.
You could of course do the same with a for of for example:
To figure out how to do something, without using the “default” is always a very good exercise. The basic idea above is to print the first element, and re-run the function if, the input is larger than one with the array minus the first element as input.
Leuchtturm1917 as the new Moleskine.