teleren/devto huggingface dataset:
Async and defer, the difference.
Tags: javascript, async, defer, webdev
Published: 2018-06-07 02:18:29

---
title: Async and defer, the difference.
published: true
description: Explication of the different modes of javascript execution.
tags: javascript,async,defer,webdev
cover_image: https://thepracticaldev.s3.amazonaws.com/i/a396wkjhp7usi7fghvio.gif
---

* **Introduction**

I recently had this problem with JavaScript files that **slowed down a web page** as soon as it was loaded. It's not nice to wait, I understand. That's why I looked at the history of async and defer.
Two different load modes, one that loads during the execution of the JS and the other that wait for everything to be loaded for the JS to run at the end.

* **Explanation of the different execution modes**

As said before for the **async**, it loads during the analysis of HTML but also the execution of JavaScript. So he loads all of a sudden.
While **defer**, patiently waiting for the page loading and analysis of HTML, it runs at the last moment.

Schema of **Async** 

![](https://thepracticaldev.s3.amazonaws.com/i/7ybpov5zmmcs71nm9pwt.png)


Code example : 

```html
<script type="text/javascript" src="assets/js/init.js" async></script>
```

Schema of **Defer**

![](https://thepracticaldev.s3.amazonaws.com/i/0ni4se2n04s32192ho6z.png)

Code example : 

```html
<script type="text/javascript" src="assets/js/init.js" defer></script>
```

* **Without both, what's going on?**

So you do not have to put these two forms of loading although it is useful, if you do not put anything in your code that will recover the JS resource, it will run at the same time as loading.

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

* **Credits**

    - `cover_image` rendered with random-background-image-with-unsplash and the spin from [Fork Awesome](https://forkawesome.github.io/Fork-Awesome/)
    - Post [was written on Busy](https://busy.org/@thomasbnt/async-and-defer-la-difference) a few months ago and is written in French.

|☕|Check my [Twitter account](https://twitter.com/thomasbnt_). You can see many projects and updates. You can also [support me on Buy Me a Coffee, Stripe or GitHub Sponsors](https://thomasbnt.dev/donate). Thanks for read my post ! 🤩|
|---|---|
The problem with starting
Tags: learning, ruby
Published: 2018-06-07 01:37:10

---
title: The problem with starting
published: true
tags: Learning,Ruby
canonical_url: http://christine-seeman.com/2018/06/the-problem-with-starting/
---

![](https://media.giphy.com/media/3o6gDSdED1B5wjC2Gc/giphy.gif)

Sometimes there is just so much information and resources that making the first step takes a long time to decide, just because you don’t where to start.  There are [so](https://www.ruby-lang.org/en/documentation/ruby-from-other-languages/to-ruby-from-java/), [so](http://rubykoans.com/), [so](https://rubymonk.com/learning/books/1-ruby-primer/chapters/6-objects/lessons/35-introduction-to-objects) [many free amazing](https://github.com/EbookFoundation/free-programming-books/blob/master/free-programming-books.md#ruby) resources for learning ruby that I keep on getting distracted jumping from one to the other.  Today did not feel like the best learning day. I didn’t get very far on my Ruby Koans, I didn’t get much other reading done (although a co-worker shared a [great article](https://github.com/EbookFoundation/free-programming-books/blob/master/free-programming-books.md#ruby) on the power of small wins that I am adding to the pile).

I need to just pick one and go with it. Going to stick with Ruby Koans, because I already started it and I feel like right now I just need to finish something.  At home I am working through [Learn Ruby the Hard Way,](https://learnrubythehardway.org/) and that is it for my resources for now.  Besides starting in on application code for work, I am going to try and limit my Ruby resource for a while because frankly I am overloaded on information right now.
Starting a ruby blog
Tags: ruby, learning
Published: 2018-06-07 01:09:42

---
title: Starting a ruby blog
published: true
description: Into about myself
tags: Ruby, Learning
---

It's 2018 so it seems like a good time to start a blog.  So I find myself starting a new career. I did this to myself, so I only really have me to blame.  I am or I was a Java engineer.  It was what I did for a living, and kind of my identity. So it was what I did for 13 years, and my god that sounds like a long time now that I am typing it out. Now that it is not the case, I signed myself up for a new career at Flywheel (not the sports one) and I have totally flipped to a Ruby stack.  To add more to my plate, I have also switched over to a Apple OS from Windows, and a start-up over a large enterprise operations.  Pretty much, it is different then everything I have done up until now.  Please wish me good luck!

http://christine-seeman.com/
My application with Flutter
Tags: discuss, flutter, android, ios
Published: 2018-06-06 23:22:49

---
title: My application with Flutter
published: true
description: 
tags: #discussion #flutter #android #ios
---

Hello, 

I'm a full stack developer, mainly with Nodejs as backend, and Angular (web pages) and Swift (for iOS) for frontend. A few months ago, I started to learn Flutter and Dart, and I finally ended up with a social network application for sharing hiking trails or travel diaries. I developed my application for a hackathon.
Here are the links 
[Android version](https://play.google.com/store/apps/details?id=com.orange.labs.spilhenn)
[iOS version](https://itunes.apple.com/fr/app/id1385377725)

<img src="https://thepracticaldev.s3.amazonaws.com/i/tbkxb4rsmm0pzo5hjq3t.png" width="400">

Not fully convinced by Flutter. With Flutter, Android works better than iOS (or maybe I missed something and I should improve my code!)
Does anybody has experience with Flutter ? I would like to have feedbacks from you to discuss about your opinion on Flutter.
What is the most Wicked (promise|async)/stream based code that you have ever done?
Tags: node, javascript, discuss
Published: 2018-06-06 22:37:20

---
title: What is the most Wicked (promise|async)/stream based code that you have ever done?
published: true
description: Care to share some experiences about it?
tags: node, javascript, discussion 
---

I remember doing a naïve (I guess, I never requested a code review from someone else) implementation  of a stream which used a mongodb cursor to process thousands of registries into another database
basically I mixed streams, eventemmiters (inherited of the stream), some generators and promise based code.
Ruby Gem markdown_helper File Inclusion Adds :comment and :pre
Tags: ruby, github, markdown, documentation
Published: 2018-06-06 22:12:02

---
title: Ruby Gem markdown_helper File Inclusion Adds :comment and :pre
published: true
description: 
tags: ruby, github, markdown, documentation
---

Gem [markdown_helper](https://rubygems.org/gems/markdown_helper) now supports including a file as a markdown comment, or as pre-formatted text.

See [What's New](https://github.com/BurdetteLamar/markdown_helper#whats-new).
Making impossible things impossible in Rust
Tags: rust
Published: 2018-06-06 16:40:48

---
title: Making impossible things impossible in Rust
published: true
description: I think I understand type safety a little bit now!
tags: Rust
cover_image: https://thepracticaldev.s3.amazonaws.com/i/hs6u64h0tjxs3vor23fb.jpg
---

I watched Richard Feldman's talk [Making Impossible States Impossible](https://www.youtube.com/watch?v=IcgmSRJHu_8) a while back when I was learning a little bit of Elm. I'm not sure I understood the execution described in his talk, but the concept of making errors literally impossible with correct data structures stuck with me. I'm in the middle of what is my most ambitious Rust project to date and struggling to get that proper data structure.

The problem centers around needing to create search strings for a web API that applies to 30+ database sets, each with unique but overlapping available search fields up to the 70s. I need it to be impossible to select an inappropriate field for a given database. 

In the genericized code below I'd like to share a couple of approaches that have become clear to me as I go through this design process. In doing so I hope to improve my own understanding and hopefully that of others with regards to type safety, implementation of traits, and data structures in Rust.

```
enum Foo {
    Foo1(Foo1Field),
    Foo2(Foo2Field),
}

enum Foo1Field {
    Foo1Field1,
    Foo1Field2,
}

enum Foo2Field {
    Foo2Field1,
    Foo2Field2,
}

struct Bar {
    foo: Foo
}

```

With this organization you know that every Bar instance will always have a "field" type appropriate to the variant of Foo assigned. It's a little cumbersome to try and access those "fields" though. This is in part because the tuples of Foo1 and Foo2 are of different types.

An alternative is making more use of traits.

```
enum Foo1Field {
    Foo1Field1,
    Foo1Field2,
}

enum Foo2Field {
    Foo2Field1,
    Foo2Field2,
}

trait Foo {}

impl Foo for Foo1Field {}
impl Foo for Foo2Field {}

struct Bar<T: Foo> {
    foo: T
}

```

With this structure I no longer need a `Foo` enum, I just need the "field" enums to implement the `Foo` trait. The Bar struct now takes any enum that implements the `Foo` trait for its `foo` field. Accessing the field values is now trivial.

```
let bar = Bar { foo: Foo1Field::Foo1Field1 };
bar.foo // returns Foo1Field1 //
let bar2 = Bar { foo: Foo2Field::Foo2Field2 };
bar2.foo // returns Foo2Field2

```

This also allows me to add fields to various database sets without duplicating fields. I simply implement a trait for the new set. Hopefully others will find this helpful. I look forward to hearing additional insights or suggestions for alternative approaches to this type of problem. Thanks for reading.
What's your team's cross-platform setup?
Tags: discuss, laravel, php, development
Published: 2018-06-06 15:14:39

---
title: What's your team's cross-platform setup?
published: true
tags: discuss, laravel, php, development
---

Hello!

I'm currently writing the backend for a new (Laravel + Vue) project. After the initial planning, we started with a fresh Laravel 5.6 installation as our initial commit. Unfortunately, as the title states, we've had a hard time getting all of our devs (especially the frontend devs who aren't familiar with Laravel) to setup a working copy of our master branch. `.env` issues, database conflicts, etc.. which I presume is because of OS differences (Windows and *buntu, mostly).

I was wondering how your team is setup to minimize / eliminate these problems so we can focus on the code itself. Share your tricks!
Is rejection for a job becoming more normal or...?
Tags: discuss, career
Published: 2018-06-06 14:26:03

---
title: Is rejection for a job becoming more normal or...?
published: true
description: It seems lots more developers are being rejected for jobs they apply for and they're being rejected over longer periods of time.
tags: discuss, career
---

It seems more developers are being rejected for jobs they apply for and they're being rejected over longer periods of time. I'm seeing more posts on various platforms (including dev.to) from developers having a hard time finding work and being without work for longer.

I know a couple devs who are awesome and passionate and excellent coders. But they went without getting accepted for a job for months, sometimes longer.

Or maybe it's just that we have so many platforms to tell our stories that these stories *seem* more prevalent?

Thoughts?
How do you learn from online material? Notes? Live coding? Just listen?
Tags: discuss
Published: 2018-06-06 14:01:38

---
title: How do you learn from online material? Notes? Live coding? Just listen?
published: true
tags: discuss
---

I was wondering what's the prefer method that people follow whilst doing an online course?

* Listen and take notes?
* Listen and code as you go?
* Just listen and do something later?
LIVE SHOW - Scalable Angular Architecture
Tags: angular, javascript, frontend
Published: 2018-06-06 10:36:46

---
title: "LIVE SHOW - Scalable Angular Architecture"
published: true
tags: angular, javascript, frontend
cover_image: https://thepracticaldev.s3.amazonaws.com/i/l2212a8q4qba665mulih.png
---
LIVE SHOW - Scalable Angular Architecture

Join us during live discussion about designing robust Angular architecture for large applications!

LINK: https://angular-academy.com/events/scalable-angular-architecture/08-06-2018/
anyone figured out a way to measure developer productivity?
Tags: discuss, productivity
Published: 2018-06-06 10:35:29

---
title: anyone figured out a way to measure developer productivity?
published: true
description: can it be done?
tags: discuss, productivity
---
I personally like to measure everything. I find that when I measure something it tends to improve. 

Programming, however, is not an easily measurable activity.

A sales person can easily be measured by the amount of merchandise they sold. Similarly, a potter can be measured by the amount of pots they produced etc. 

But in programming, often less is more. Writing a function using 25 lines of code is typically better than a function that does the equivalent using 250 LOC. Reusing an existing functionality to fulfill a new feature is far better than writing it from scratch. Etc. 

So my question is, did anyone figure out a good way to measure a developer's productivity?
Updates On Code.xyz-The Online Code Editor For Building APIs!
Tags: api, javascript, node, cloudcompute
Published: 2018-06-06 08:20:03

---
title: Updates On Code.xyz-The Online Code Editor For Building APIs!  
published: True
description: 
tags: #api #Javascript #nodejs #cloudcompute  
---

{https://stdlib.com/blog/code-xyz-updates-06-06-2018}
How does your development process look like?
Tags: discuss, devops
Published: 2018-06-06 02:23:43

---
title: How does your development process look like?
published: true
description: 
tags: #discuss #devops
---

I'm part of a small team and we're trying to redefine our development process to be more effective and intact. I want to have insight on how other teams, big and small, does it. Can you share a walk-through of your development process, from ticket to release, or alike. :)
How will GitHub change, now that it's owned by Microsoft?
Tags: discuss, github, microsoft, opensource
Published: 2018-06-06 01:11:58

---
title: How will GitHub change, now that it's owned by Microsoft?
published: true
description: Whether this makes you happy or sad, what's your best guess on what it will actually mean for GitHub users?
tags: discuss, github, microsoft, opensource
cover_image: https://thepracticaldev.s3.amazonaws.com/i/hv7oyb1igi1wwldy3dec.png
---

Whether this makes you happy or sad, what's your best guess on what it will actually mean for GitHub users?
Pobody's Nerfect
Tags: beginners, webdev, career
Published: 2018-06-06 01:00:30

---
title: Pobody's Nerfect
published: true
description: If you want to get into tech, throw perfectionism out the window.
tags: beginner, webdev, career
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ye2qepp8755i9qfmo35e.jpg
---

I recently went through my [Github](http://github.com/catcarbonell) repo to label my school projects in the event of encountering recruiters mid-scouting.

Reading through my code trying to decipher which project belonged to what class, 

## I cringed.

I recognized projects where I experienced immense growing pains.

I remembered the feeling of frustration fueled by the toxic cocktail of my naiveté,  the excuse of a short and strict timeline, depression and perfectionism.

## Perfectionism is problematic.

I have always had the nasty habit of comparison. 

Related to it, I have the wonderful talent of encountering developer-designers at their peak or rising to it.

They were the epitome of career perfection.

Thus, the act of comparing myself to these shining examples of the ideal developer/designer has kept me down, and I am the only one to blame.

## The act of comparison is a complete waste of time.

Spending time comparing yourself to someone else produces absolutely nothing. That could've been spent *learning* and growing and becoming one of the so-called elite.

The "elite" made mistakes.

The "elite" started from not knowing anything at all, too. 

Even those who are influential began with spaghetti code and off-center layouts.

## I have accepted the fact I will never be perfect.

I will stumble and fall through coding *and* designing experiences. 
I will continuously blunder through building a product. 

But the truth is, that's part of the process, even post-graduation/bootcamp, even while you're well into your career.

You know the age-old techie mantra:

>Move fast and break things

Drop the "move fast" part.

Rather, 

## Break things and learn from it. 

Understand concepts and methods through and through so that you spend less time on research, or at least learn the right keywords to find it again, but faster. 

For instance, I keep forgetting the short-hand format for CSS font-styling:

` font: font-style font-variant font-weight font-size/line-height font-family;`

I just had to look that one up for this post. Now I will forget it less and less.

The point is: 

## if you're not breaking things, you're neither learning nor improving.

To be perfect is to be without flaws, right? You don't have to fix a damn thing about something that's perfect.

Let's be real: "perfection" becomes stale.

Throw the idea of "perfectionism" out the window.

Instead, strive for improvement. Strive to be a better you, a better developer, a better designer than yesterday.

---

I'm leaving my less-than-perfect school projects in my repo so that I can look back and see how much I've improved since.

---

* P.S. I highly recommend watching "The Good Place".
Type-checking in Python
Tags: python, types, typechecking
Published: 2018-06-06 00:59:14

---
title: Type-checking in Python
published: true
description: Type check functions in Python 2 & 3
tags: python, types, type-checking
---

Type checking function arguments is a common sanity check for function arguments in Python.

## What do you mean "type-checking function arguments"?

Let's say you have a function `add` that takes in two arguments `a` and `b`. There is an implicit understanding that `a` and `b` must be either integer (type `int`) or float (type `float`).

```python
def add(a, b):
    return a + b
```

`add(1, 2)` gives the output `3` which is what we intended the function for.
But `add([2], [3])` seems to be returning `[2, 3]`, a concatenated list.
Also `add((2,), (3,))` seems to be returning `(2, 3)`, a concatenated tuple.

To operate only on `int` and `float` arguments, we can add `type` or `isinstance` checks. Check out this [StackOverflow post](https://stackoverflow.com/questions/1549801/what-are-the-differences-between-type-and-isinstance) for understanding the difference between `type` and `isinstance` checks.

```python
valid_add_types = (int, float)
def add(a, b):
    if isinstance(a, valid_add_types) and isinstance(b, valid_add_types):
        return a + b
    return None
```

`add(1, 2)` gives the output `3` which is what we intended the function for.
`add([2], [3])` and `add((2,), (3,))` return `None` because they're are neither integers nor floats.

Pros:
* It can help you, the developer, understand what types of arguments a function needs at a glance
* Useful for existing and new developers
* Bug-fixes and feature additions are less painful

Cons:
* It is manageable for small codebases
* Manual type checking makes large codebases convoluted

In the course of discussing how to improve the Developer Experience (DX) of a Python developer, my mentor, Sriram, and I came with up with an idea of a type checking decorator for type checking function arguments.

Introducing [`typy_checker`](https://github.com/onstash/typy_checker), an easy-to-use library for type-checking your functions without losing your sanity over it.

Here is how we could use `typy_checker` in our example.

```python
from typy_checker import type_checker

valid_add_types = (int, float)
@type_checker(a=valid_add_types, b=valid_add_types)
def add(a, b):
    return a + b
```

Calling `add([2], [3])` will result in the following error - 

```
SystemError: add(): Invalid type for variable 'a'. Expected int / float but got list.
```

Using `typy_checker` results in a cleaner codebase, from my experience. I have used it in two codebases and they are running in production at the moment.
How to choose the stack for a project?
Tags: beginners, webdev, discuss
Published: 2018-06-06 00:48:00

---
title: How to choose the stack for a project?
published: true
description: 
tags: #beginners, #webdev, discuss
---

I'm new at programming and have a list of projects I would like to work on. Just having a hard time deciding which language, frameworks and tools to use. How do you decide which stack to use?
Example for LaTeX Funeral or Memorial Program
Tags: latex
Published: 2019-07-06 00:19:57

---
title: Example for LaTeX Funeral or Memorial Program
published: true
tags: latex
canonical_url: https://sean.lane.sh/posts/2018/06/Example-for-LaTeX-Funeral-or-Memorial-Program/
---

Another quick post, but something that I hope might be useful to others. Within the past couple weeks, my grandmother of 83 years passed away and my family held a memorial service in her honor. I was asked if I could help out in creating a program booklet or pamphlet that could be given out to the attendees, something that would describe the service itself as well as share a piece of my grandmother’s life with them as we gathered to remember her. Grandma Arlene was a classy lady and I wanted to help her leave a lasting impression on all of those who could make it out to honor her life. As a graduate student in Computer Science, I felt like using LaTeX would be a great way to do so, though my Internet searches fell somewhat short of what I was looking for. We wanted a simple layout consisting of four “pages”, two of which would be printed on a single side of standard sized US letter paper, and then folded into a four page pamphlet after printing. This could also serve well for someone looking for a LaTeX template for religious or other services where a 4 page booklet is desired.

The files for this project can be found on GitHub here: [Example for LaTeX Funeral or Memorial Program](https://github.com/seanlane/LaTeX-Funeral-Program)

The project makes use of standard LaTeX components as well as the `pgfornament` package to add some style to the program. The general process is as follows:

1. Edit the `main.tex` file as needed
  - Note that you will need to adjust paper size as needed to fit onto a half of the paper size you intend to use. As it currently stands, it’s set to be printed on a 8.5 inches by 5.5 inches section of 8.5 inches by 11 inches sized US letter paper
  - Also modify your images as needed. My grandmother was a prodigious quilter, and we wanted to have one of her quilts serve as the background for the third page where the actual service is described.
2. Use the `Makefile` default command to make the main file, which will produce 4 pages on the size of paper specified in `main.tex` and then take those four pages and place them on both sides of US letter paper as described by `booklet.tex`.
3. I found that the pages of the output `booklet.pdf` were still oriented in a portrait orientation, so I used Apple Preview to rotate the pages. There may likely be a programmatic way to address that issue, but I never bothered to resolve it.

Below are screenshots of the output.

---

First page

![First page of the final PDF output](https://sean.lane.sh/images/2018/06/latex_funeral_program_pg1.png)

---

Second page

![Second page of the final PDF output](https://sean.lane.sh/images/2018/06/latex_funeral_program_pg2.png)