👊 First post for 2021!

Image for post
Image for post

Recently I decided to adopt fp-ts lib on a side project.

What is Fp-ts?

It’s a library that provides abstractions from typed functional languages that makes it easy to apply functional patterns when developing in TypeScript.

My motivation in adopting fp-ts was:

  • I’ve been charmed by languages such Haskell and Rust and wanted to use some familiar ADTs in the code (Option/Maybe, Just/Some, Either/Result, None).
  • I liked the Error handling approach.
  • I wanted to figure out if it can really improve my typescript projects while enjoying the functional style.

I’ve been reading the fp-ts docs…

Say hello to tsttgen

Image for post
Image for post

A few weeks ago I started to develop a CLI tool in Rust under the name tsttgen which stands for Typescript Test Templates Generator.

In short on tsttgen — my initial motivation was, of course, improving my Rust skills, but the idea behind the tool is to automate the boilerplate creation part in generating typescript files which contain tests format that is used when developing e2e in typescript with TestCafe.

As the time passed and I wanted to keep developing tsttgen, I thought it would be really nice to serve a static report of tsttgen run…

Let’s create a web component based on a hardware device!

Image for post
Image for post

** NOTE: I originally published this post to the Wokwi’s official blog.

In the following post, I will describe my personal experience in making a web component based on a hardware device, as part of contributing to “Wokwi-elements”. It’s an extremely cool open source library for “Arduino elements” made by Uri Shaked.

The creativity behind the Wokwi lib immediately caught my mind and I recognised an opportunity to play with new techniques and gain more experience with concepts I was experienced with.

If I’ll shortly try to explain what Wokwi

Image for post
Image for post

Lately I’ve been refactoring a huge module in our code base.

Refactor is an expensive process to the organisation, it means that I’m spending my (expensive) time on improving something that already gives value to the field instead of creating new features that will help in selling the product.

But it also means that the next time someone will need to add a new feature to the module it will take less than it was before — and hence — one of the benefits of the process.

  • Code decoupling, make it DRY, reduce WTF scale -make it SOLID
  • The code…

Intended for Javascript developers (BUT not just)!

Image for post
Image for post

Disclaimer: This post won’t teach you Rust, the motivation is to get you started quickly into WASM using the amazing wasm-pack tooling on top of the intuitive Rusty ecosystem.

Not so long ago I started to get interested in Rust - How did that happen?

There’s a HYPE around WASM (Web Assembly) and it triggered a need I have with getting my hands dirty with new things.. I wanted to be a part of that party 🎉 🎊 🎈.

I started reading a bit about wasm here and there:

“ WebAssembly is a new type of code that can be…

Let’s cause some reactions and easily share state with just a few lines of code.

Image for post
Image for post

Disclaimer: This post won’t teach you the “observer pattern”.

In this quick post I’ll share a use case I had and how I resolved it without importing an external tool.

On one of my side projects, (emulated looper), the view layer (couple of buttons) must update the logic layer whenever a state changes.

The logic layer will react accordingly.

It’s a Typescript project, and I’m not using any framework, just the DOM and I.

In such case, I don’t see any point of using an external tool — (I like working with rxjs Subjects btw, awesome lib 😎 👏 ).

Enter → Selections. Going under the hood ☕

Image for post
Image for post

Care to understand how things work under the hood? if so I assume you already reached out the following Mike Bostock’s (the creator of d3) post from 2013.

The post explains the selections implementation. Tough 2013 seems like a lifetime ago in Javascript, the general concepts are the same.The post described the selections structure as a subclass of array. but that was in the past when version 3 was the latest.

Today the returned selection structure is an object.

The selection holds:

  • An array of the selected elements (groups).
  • An array of the root element.
  • Accessors to the transformation methods…

Image for post
Image for post

Few weeks ago, I decided to challenge myself in learning Haskell. My motivation was to get a better grasp of functional patterns. ( such functors or monads There are a lot more here → The Patternopedia). In one-line of Haskell you can describe abstractive concepts — this is very powerful.

Haskell is different from the other languages I’m familiar with. But I eventually came up with a try to implement a functor in TS, which I called a “List Functor”. You can find the explanation on my previous post. BTW check out the following impressive project fp-ts.

A Functor is a structure which implements a map() function. It is used as a context wrapper around a certain data/structure the user aims to transform.

That structure we pass to the functor could be of any type but in this post I’ll demonstrate a functor which get’s a list of data. (functors are everywhere, you can find several functors types here).

We can think of a functor as a structure that we need in order to pass an item from a set of values A to a different set of values — let’s say B (we do so by…

Liron Hazan

Mom gave *rock&roll* to yah —FE Tech Lead@ SentinelOne | occasional consultant..

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store