21.11.2017 01:00

jQuery in 2017

21.11.2017 01:00

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?

I’m not sure if there is or should be room for jQuery with libraries like Angular, Vue or React; because of the differences in how they work with the DOM. With libraries like jQuery you treat the DOM as the “truth”, while with for example react you render things to the DOM from data in Javascript. Then you soon end up with some “interesting” results if you add some jQuery plugin or code that starts to change the code you just rendered.

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.


20.11.2017 01:00

Hello World


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.

Leuchtturm1917 as the new Moleskine.

19.11.2017 01:00

```text When I talk about Moleskine, not the current incarnation of it, and more the idea than the product itself, it is with good memories. There are many good things about them as a brand, even though the product itself is beyond shit from a paper perspective. ```

```text I have been hoping for Leuchtturm1917 to become the new Moleskine for a while now. And I kind of see it happening. Their products have much of the same general aesthetic. I have even seen Leuchtturm1917 notebooks in similar setups in som stores here in Norway. You know the narrow and tall square things Moleskines always are in at bookstores? ```

```text Their lineups are also very similar, the biggest difference is that Moleskine have way more “special editions” and “special use case editions”. And I really wish Leuchtturm1917 extended more in the latter category. ```

```text What I mean when I say I wish that Leuchtturm1917 becomes the new Moleskine is just that Leuchtturm1917 is becomes default “fancy notebook” for regular people. And that you can get them everywhere. But that the product and the paper remains the same. ```

```text The thing I still like about Moleskine to this day, is the fact that if I want to do X for example travel or cooking. I can find a good notebook layout for X from Moleskine. And for what ever company that want to kick them off their trone, need to copy and out do them both there and in the available everywhere and in your face part. ```


18.11.2017 01:00