20.11.2017 01:00

Hello Spacemacs


20.11.2017 01:00

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.

First, open a terminal and cd ~/.emacs.d/private && wget raw.githubusercontent.com/tkf/emacs… && wget gist.githubusercontent.com/hjertnes/…

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:

(load “~/.emacs.d/private/request.el”)

(load “~/.emacs.d/private/mb.el”)

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.


20.11.2017 01:00

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

20.11.2017 01:00

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

cd /usr/local/src

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

cd openssl-1.0.2h

./configure darwin64-x86_64-cc –prefix=/usr/local/openssl-1.0.2h shared

make depend


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:

export CPATH=$CPATH:/usr/local/src/openssl-1.0.2h/include

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/src/openssl-1.0.2h/lib

chicken-install openssl

Looping without loops.

20.11.2017 01:00

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.


18.11.2017 01:00


17.11.2017 01:00

Hello, World

17.11.2017 01:00

Higher order Functions

17.11.2017 01:00

Higher order functions (or components, if you’re using React) is a functions that does at least one out of two thigns. It takes a function as a argument; not its value, but the function itself. Or it returns a function itself; again, not the value from it but the function itself. This might be considered a very exotic topic in many languages, but should be common practice for every JavaScript developer. You are doing this every time you use a callback, a map/filter/reduce or a promise.

```text The short example above are using a higher order function to double each element in the list. And the example below uses a higher order function that returns a function. ```

```text Higher Order Functions, in both forms is a very useful teqnique to avoid a lot of almost identical code. And even more useful when you start to code in React by doing the same thing just by taking components as arguments instead of functions or returning components instead of functions. ```


16.11.2017 01:00