This Week I Learned #8
Tags: javascript, devops, python, reason
Published: 2018-07-05 08:13:18

---
title: This Week I Learned #8
published: true
description: JavaScript, Python, Reason, and more! Three weeks worth of fun tech stuff to look forward to!
tags: javascript,devops,python,reasonml
series: This Week I Learned
---

![This Week I Learned](https://thepracticaldev.s3.amazonaws.com/i/x6m33rdtnm9n5a3djtvd.JPG)

JavaScript, Python, Reason, and more! Fun tech stuff to look forward to!

## [JavaScript Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy)


Proxies in JavaScript allow us to add hooks to objects. For example, when a value in an object is being extracted or being set, we can execute some side-effect or override the value being returned. This is helpful if you want to do some simple pub-sub actions, e.g. informing other objects if an object's value has changed. This can also be helpful if you want to do validation, e.g. the value in the object will remain the same if the value it was set with was invalid. This is a very powerful feature so check it out and see what creative ways you can use JavaScript proxies in!

Here's a basic validation example from MDN:

```javascript
let validator = {
  set: function(obj, prop, value) {
    if (prop === 'age') {
      if (!Number.isInteger(value)) {
        throw new TypeError('The age is not an integer');
      }
      if (value > 200) {
        throw new RangeError('The age seems invalid');
      }
    }

    // The default behavior to store the value
    obj[prop] = value;

    // Indicate success
    return true;
  }
};

let person = new Proxy({}, validator);

person.age = 100;
console.log(person.age); // 100
person.age = 'young'; // Throws an exception
person.age = 300; // Throws an exception
```

---

![FormSpree](https://thepracticaldev.s3.amazonaws.com/i/54p15boc851lqo36w03o.png)

## [FormSpree](https://formspree.io/)

One of the things that throw you off when you want to create a landing page or just a simple static homepage is the issue of forms. Where would you send them if you don't have a server?

FormSpree deals with that problem by receiving the data from the form and forwarding the data to your email. It has a pretty okay free tier and for unlimited amounts of emails you just have to pay $10 per month.

```html
<form action="https://formspree.io/your@email.com"
      method="POST">
    <input type="text" name="name">
    <input type="email" name="_replyto">
    <input type="submit" value="Send">
</form>
```

## [for-await-of](http://2ality.com/2017/12/for-await-of-sync-iterables.html)

Sometimes it's helpful to put Promises in an array and loop through their resolved values, like when making a lot of requests via `fetch` or `axios`. When dealing with an array of Promises, we usually use Promise.all to make sure they're all resolved, right? The problem with this is that it will wait for all of the Promises to resolve first before we can actually work with them. What we want is to get each request and start working with them the moment they resolve. How do we do that? We can use the for-await-of JavaScript syntax.

Here's an example from from Dr. Axel Rauschmayer's blog. Basically instead of using Promise.all like this:

```javascript
for (const x of await Promise.all(syncIterableOverPromises)) {
    // Do something with x
};
```

we do this instead:

```javascript
for await (const x of syncIterableOverPromises) {
    // Do something with x
};
```

This will get each `x` in the `syncIterableOverPromises` iterable and then wait for it to resolve then proceed to the body of the for loop to work with the resolved `x`. This makes it easier to start working with a list of Promises without waiting for all of them to complete.

---

![Clementine](https://thepracticaldev.s3.amazonaws.com/i/djxhn39zhcotmxnif6wf.png)

## [Clementine](https://in.airdev.co/clementine)

If you have difficulty trying to build your application specs and the cost for building the application, you can use Clementine for that! Clementine guides you through the process of building your app specs, and at the end, estimates how much building the application would cost.

![Vibora](https://thepracticaldev.s3.amazonaws.com/i/lraoffejritvormi03s7.png)

## [Vibora](https://vibora.io/)

If you like building Web APIs with Python with Django or Flask, why not take Vibora out for a spin? Vibora is a new web framework for building fast APIs, faster than most of the popular Python web frameworks out there. Inspired by Flask, Vibora is pretty easy to use and it is fully asynchronous. Check out their benchmarks on their site to see for yourself!

![Transfer.sh](https://thepracticaldev.s3.amazonaws.com/i/as3yn2zk7i47ewo0vsi4.png)

## [Transfer.sh](https://transfer.sh/)

If you want to share files for free without leaving your terminal, transfer.sh is the thing or you! If you the installation instructions, you'll have a transfer binary that you can run to upload a file. After uploading, you'll be presented with the download link you can send to your friends! The link lasts for 14 days and can be as big as 10 GB. The best thing is that it's free! Check it out!

![Sail CI](https://thepracticaldev.s3.amazonaws.com/i/vuttq3ofd7rstthzcpk6.png)

## [Sail CI](https://sail.sh/)

If you want a hosted CI solution that's cheap, easy to use, and has a great free tier, check out Sail CI! You have 1000 build minutes per month which is already good enough compared to most hosted solutions out there. It's also pretty to setup! Just go to your project directory, run `sail init` , define your pipeline in a `.sail` file and you're all set!

It currently only supports Github, but we'll probably see support on the others like Gitlab and Bitbucket in the near future!

![Why do I Procrastinate](https://thepracticaldev.s3.amazonaws.com/i/e5yk3nwb6p925mts1d8y.png)

## [Why do I Procrastinate](https://whydoiprocrastinate.com/)

This site asks you some questions and figures out why you're procrastinating. After that, it gives you recommendations on what to do to stop procrastinating and start working!

![ML5.js](https://thepracticaldev.s3.amazonaws.com/i/q6hz4fn155z36mowm0jb.png)

## [ML5.js](https://ml5js.org/)

TensorFlow.js took the web world by storm but to some still feel it is complicated even for common tasks. ML5.js makes this simpler by having a relatively easier API for dealing with common tasks like image classification. If you've been itching to do Machine Learning on the web, try this out!

![Mkcert](https://thepracticaldev.s3.amazonaws.com/i/likr9kswhm1oj68rgzqr.png)

## [Mkcert](https://github.com/FiloSottile/mkcert)

When developing for the web, sometimes we need to test our applications with HTTPS enabled. The problem is that most of the time, that is difficult - so features that require HTTPS to work can't be tested on locally. Mkcert helps us with this problem by being a zero-config tool for creating certificates for HTTPS. Next time you need HTTPS for local testing, try Mkcert out!

![Get HTTPS for Free](https://thepracticaldev.s3.amazonaws.com/i/r16z3cz87n98buqr0awr.png)

## [Get HTTPS for Free](https://gethttpsforfree.com/)

Let's be honest - the process of getting a certificate from Let's Encrypt is not a piece of cake. Get HTTPS for Free helps you create your own certificates and get them signed with Let's Encrypt with relatively easy to understand instructions - and all you need is a terminal window and the single page of the site. The site doesn't look too great, but it works!
Side note: I'm trying to recreate the site with another design - if you want to help me out here: [https://github.com/johnpaulada/gethttpsforfree-redesign](https://github.com/johnpaulada/gethttpsforfree-redesign)!

## [Railway-Oriented Programming](https://fsharpforfunandprofit.com/rop/)

When developing applications, we usually focus on the happy path - on how the application should be behaving, but when you think about it, errors are also part of the program. Therefore, we also have to assume errors are going to happen and assume that there will be two paths: the happy path and the failure path. That's what Railway-Oriented Programming is all about. Our program should always take those two paths in consideration. Check it out if you're interested! 😄

![ReasonML Philippines](https://thepracticaldev.s3.amazonaws.com/i/bk2vfyaucji1zokjucld.png)

## [ReasonML Philippines](https://www.facebook.com/groups/202735933780478/)

ReasonML is an awesome language created by Jordan Walke, the same guy who created React at Facebook. I've been very interested in it since the time I heard it last year during ReactConf 2017 during Cheng Lou's talk. I noticed that there weren't a lot of ReasonML enthusiasts in the Philippines - heck there wasn't even a Facebook group! So I created one! If you're from the Philippines, or even if you're just plain interested in ReasonML, please join us in the group! 😃