hjertnes.blog

#

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

make

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

#

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

Join

16.11.2017 01:00

Join is a method living on the String prototype. All it does is to take a list of strings and combines them into a string, either with or without a dividing character. Very useful if you have a array of something that you want to list out seperated by a comma or something like that. Below is an example, both with Join and I also re-implemented join as a reducer, just because they are so similar; but reduce is far more powerful.