teleren/devto huggingface dataset:
Flutter: Renderizando widget após chamada assíncrona
Published: 2020-03-18 23:34:32

A melhor maneira de fazer isso é usar um [FutureBuilder](https://docs.flutter.io/flutter/widgets/FutureBuilder-class.html).
Da documentação do FutureBuilder:

```dart
new FutureBuilder<String>(
  future: _calculation, // a Future<String> or null
  builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
    switch (snapshot.connectionState) {
      case ConnectionState.none: return new Text('Press button to start');
      case ConnectionState.waiting: return new Text('Awaiting result...');
      default:
        if (snapshot.hasError)
          return new Text('Error: ${snapshot.error}');
        else
          return new Text('Result: ${snapshot.data}');
    }
  },
)
```

A outra coisa é que você está construindo seu widget fora do método State.build e salvando o próprio widget, que é um antipadrão. Você deve estar construindo os widgets toda vez no método de construção.

Você pode fazer com que isso funcione sem o FutureBuilder, mas você deve salvar o resultado da chamada http (processada apropriadamente) e depois usar os dados dentro de sua função de compilação.

```dart
import 'dart:async';
import 'dart:convert';

import 'package:flutter/material.dart';

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'async demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  List data;

  @override
  initState() {
    super.initState();

    new Future<String>.delayed(new Duration(seconds: 5), () => '["123", "456", "789"]').then((String value) {
      setState(() {
        data = json.decode(value);
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    if (data == null) {
      return new Scaffold(
        appBar: new AppBar(
          title: new Text("Loading..."),
        ),
      );
    } else {
      return new Scaffold(
        appBar: new AppBar(
          title: new Text(widget.title),
        ),
        body: new Center(
          child: new ListView(
            children: data
                .map((data) => new ListTile(
                      title: new Text("one element"),
                      subtitle: new Text(data),
                    ))
                .toList(),
          ),
        ),
      );
    }
  }
}
```
Fixing libcrypto ansible crashes on macOS
Tags: ansible, openssl, fix, macos
Published: 2020-03-18 22:45:10

Recently, I was having consistent crashes on macOS with `ansible` when running certain playbooks (especially when deploying to OpenShift). These errors were quite non-informative since the only feedback I got was, for instance:

```
[1]    71538 abort      pipenv run ansible-playbook deploy_kafka_operator.yaml -e  -e NAMESPACE=...
```

## The cause

Looking at the crash dump I could find the following information:

```
Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff6fb1e7fa __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff6fbdbbc1 pthread_kill + 432
2   libsystem_c.dylib             	0x00007fff6faa5a1c abort + 120
3   libcrypto.dylib               	0x00007fff6d40d804 __report_load + 352
4   dyld                          	0x00000001113e615d ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 539
```

OK. So I *shouldn't* load the unversioned `libcrypto`. I kinda I knew that, but that doing it *willingly*...

## The fix

First things first. Make sure you have the latest `libcrypto` installed (using `brew`, in my case):

```shell
$ brew update ; brew upgrade ; brew install openssl
```

Next, from the installed `openssl` (in my case, located at `/usr/local/Cellar/openssl/1.0.2t/`) copy the following two libraries to `/usr/local/lib`:

```shell
$ cd /usr/local/Cellar/openssl/1.0.2t/
$ sudo cp libcrypto.1.0.0.dylib libssl.1.0.0.dylib /usr/local/lib
```

The next step is to symlink them:

```
$ cd /usr/local/lib
$ sudo ln -s libssl.1.0.0.dylib libssl.dylib
$ sudo ln -s libcrypto.1.0.0.dylib libcrypto.dylib
```

Lo and behold, problem fixed.
Flutter: Como adicionar sombra ao TextFormField
Tags: flutter
Published: 2020-03-18 23:24:07

Aprenda como adicionar sombra ao TextFormField no Flutter utilizando o widget Material. Você pode utilizar o TextFormField com um Material widget e editar suas propriedades, como elevation e shadowColor.

### Exemplo:
```dart
Material(
              elevation: 20.0,
              shadowColor: Colors.blue,
                          child: TextFormField(
                obscureText: true,
                autofocus: false,
                decoration: InputDecoration(
                    icon: new Icon(Icons.lock, color: Color(0xff224597)),
                    hintText: 'Password',
                    fillColor: Colors.white,
                    filled: true,
                    contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
                    enabledBorder: OutlineInputBorder(borderRadius:BorderRadius.circular(5.0),
                    borderSide: BorderSide(color: Colors.white, width: 3.0))
                ),
              ),
            )  
```
Você vai ter algo parecido com a imagem abaixo.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5ivog4od5uae0c37bf3k.png)
Day 97 : Can't Truss It
Tags: hiphop, code, coding, lifelongdev
Published: 2020-03-18 23:20:30

_liner notes_:
- Professional : Feeling pretty good today. Got up early for a meeting. Afterwards, knocked out a demo for s JIRA ticket to show a feature of the SDK. Showed team members to get some feedback and some thoughts I had. Attended a couple of more meetings. Got some really good suggestions from my team members. Figured out how to implement them and got it working.

- Personal : Last night, I went through a bunch of tracks for the radio show. I also researched how to get the web component I made uploaded somewhere so that another website could use it. Oh and the results from the polls came in last night... Can't Truss It! haha.

![A view into a mountain valley in Yanacachi, Bolivia](https://dev-to-uploads.s3.amazonaws.com/i/fa9ijilnkgm8k18gqv8l.png)

Will probably go through some more tracks. The station will be closed this week understandably, but I'll broadcast from my house online only. Also going to see if I can include the new web component I published online into my website. We'll see how that goes.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube am9BqZ6eA5c %}
Top 5 DEV Comments from the Past Week
Tags: bestofdev
Published: 2020-03-18 23:17:36

---
title: Top 5 DEV Comments from the Past Week
published: true
description: Highlighting some of the best DEV comments from the past week.
tags: bestofdev
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--7VrAA2ln--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://thepracticaldev.s3.amazonaws.com/i/qmb5wkoeywj06pd7p8ku.png
---

This is a weekly roundup of awesome DEV comments that you may have missed.  You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag.

@pclundaahl offered some suggestions in response to **[What can a backend dev do to improve Accessibility?](https://dev.to/vickilanger/what-can-a-backend-dev-do-to-improve-accessibility-1ca8)**:
{% devcomment mhb8 %}

@joeattardi added some useful tips around `git bisect` in **[Track Down Pesky Bugs with `git bisect`](https://dev.to/thawkin3/track-down-pesky-bugs-with-git-bisect-1i4i)**:
{% devcomment mg5c %}

@jamesthomson shared their UID generator trick in **[Vue advanced tricks cheat sheet](https://dev.to/adnanbabakan/vue-advanced-tricks-cheat-sheet-3ee3)**:
{% devcomment mfm4 %}

@codebarber offered their advice around **[How to Maximize Productivity Working From Home?](https://dev.to/storrence88/how-to-maximize-productivity-working-from-home-1e01)**:
{% devcomment mhgn %}

@ianturton talked about their experience with open-source projects forking in **[License to restrict too many forks](https://dev.to/wolfiton/license-to-restrict-too-many-forks-6dh)**:
{% devcomment mhnp %}

See you next week for more great comments ✌
Quarantine Assistant - part 1 - my project for HackCrisis
Tags: quarantine, covid, coronavirus, hackathon
Published: 2020-03-18 23:04:17

About two days ago in Poland have started HackCrisis, the hackathon for fighting with coronavirus and how it affects the economy. 

Me and my bro, we decided to make a mobile application for helping local authorities to control people in quarantine. Since we are on the start, we have been expecting tons of thousands of sick people which may be extremely hard to control by police and army.

### Main features of our application:
* send information about device localization,
* inform about a current medical condition,
* inform about people needs (food and medicines),
* securely store and transport data,
* display processed information on the dashboard for authorities,

We develop the application to React Native and Nodejs with Express. Servers are hosted in DigitalOcean in Frankfurt. Soon I am going to show more about the application 😉

Stay safe and healthy! Wash your hands and avoid other people.
How to organize custom code for plugins & themes
Tags: plugins, code, wordpress
Published: 2020-12-31 09:34:56

---
title: How to organize custom code for plugins & themes
published: true
date: 2020-03-18 22:15:23 UTC
tags: Plugins,code,WordPress
canonical_url: https://ovirium.com/blog/how-to-organize-custom-code-for-plugins-themes/
---

You have lots of plugins and even a theme. You are brave and adventurous - and you write (or copy-paste) lots of snippets to modify their default behavior. Now you have a custom code all over the place and even in your theme functions.php.  
 Is there a better way to fix that mess?

The post [How to organize custom code for plugins & themes](https://ovirium.com/blog/how-to-organize-custom-code-for-plugins-themes/) appeared first on [my blog](https://ovirium.com).
DAY 3: So bored of WFH.
Tags: watercooler, discuss
Published: 2020-03-18 21:45:19

It's not so fun when you have no choice.

My Son decided to turn the WIFI off mid meeting, he is literally clinging to me all day, smashing keys and grunting through slack calls, I am going to go spare. its been 3 days, how on earth is anyone productive full time at home.

How are you staying productive?
Can you expect to be productive?
Do you have hobbies?
All that stuff, or just want to chat, share something down in the comments.

Jira ticket COVID-19 is a bitch.

Ben, If your there, I wonder if for the time being we could get a COVID-19 tag so that we can share our experiences?
Run a remote Node.js file quickly
Tags: node, javascript, webdev, typescript
Published: 2020-03-18 21:31:12

If you have a local Node.js file that does something, it's very easy to run:

```bash
node path/to/file.js
```

However, if you have a remote file on a URL, say https://example.com/script.js, you have several steps before you can get your desired output in your terminal:

1. Download script.js (using `curl`, for example) to a directory
2. Create a `package.json` file to make sure it runs
3. Check if it has any external dependencies
4. Install external dependencies (using `npm install`, for example)
5. Use `node script.js` to execute it

This is too much of work, especially if you want to get started quickly. So, introducing [**run-url**](https://github.com/AnandChowdhary/run-url): an open-source npm remote URL runner written in TypeScript.

Now, you can just run the URL using `npx`, just like you're used to:

```bash
npx run-url https://example.com/script.js
```

You can also install `run-url` globally:

```bash
npm install --global run-url
```

And it'll be available in your terminal:

```bash
run-url https://example.com/script.js
```

## Running GitHub Gists with Node.js

If you quickly want to prototype, a great way is to create a GitHub Gist. For example, I have the following: https://gist.github.com/AnandChowdhary/3c0400b29a18a2afff7a23e2a3308c22#file-log-moment-js, which has a dependency (`moment`) and outputs the current date.

Simply copy the raw URL of the gist file and run it:

```bash
npx run-url https://gist.githubusercontent.com/AnandChowdhary/3c0400b29a18a2afff7a23e2a3308c22/raw/8ab3ca87821511e580d72585c72736b833d18697/log-moment.js
```

`run-url` will install the required dependency (in this case, `moment`) in a temporary folder, run the Node.js file, and then remove the temporary folder. Just like `npx`, it just works.

[See the source on GitHub](https://github.com/AnandChowdhary/run-url) or [Download from npm](https://www.npmjs.com/package/run-url)
React dev urgently needed for Corona volunteer matching platform
Tags: react, hiring, help
Published: 2020-03-18 20:49:28

_UPDATE: We are not rebuilding Facebook and there is only so much dev work to be done. We have received over 30 applications, way more than we ever thought we could get and we will choose from that list. We are grateful and humbled by all the offers we have received from you. Thank you!_

# What's the deal?
We have been working on [helping-hands.io](http://helping-hands.io) for the past days and we have just launched the first version in Germany a few minutes ago. Our plan is to quickly expand internationally because of network effects, starting with an English version of the app this week still and then go into Italian, Spanish and other languages as we get translators in.

# What do we need?
We are looking for a React developer. The basic features are already covered but as you flip through the screens, you probably already have some ideas going through your head – picture those ideas as features of the version that you help create!

We have received a first donation which goes straight into ads, because precise reach of people is everything. Therefore we can't pay you a salary. But:

# What's in it for you?
- You do the right thing. We all do this next to our full-time jobs and we are just trying to make it work.
- You can add it to your portfolio. The project has already attracted interest from the media and we expect more as we grow – and grow we will: Other sites in Germany went well beyond 10k signups within a matter of days already but they are unable to process that volume (let alone go international) because they are essentially entries in Google sheets which need to be manually matched.
![Meme: Sounds good doesn't work](https://i.kym-cdn.com/photos/images/newsfeed/001/305/222/ae7.gif)
- You don't have to commit long-term. A few days will already make a big difference.
- The full startup experience: Slack, Trello, launch on ProductHunt this week, time pressure, fast growth. All of us are experienced with these things and we take this very seriously.
- You can work from home. Obviously...

# How to connect
If you want to join, write me here, via [Twitter](https://twitter.com/_ajascha), [LinkedIn](https://www.linkedin.com/in/awolfewicz/) or fill [this](https://forms.gle/MxYww8YZmbQYu4xS6) form. But don't leave us hanging for too long – we are in a special situation that requires special people. And there are people who are depending on help from others who can't get it – right in _this_ moment!

_Thank you to [Ben](https://dev.to/ben) and the DEV team for boosting this post. We highly appreciate it and all the work you are continuously putting into this platform!_

![Meme: I am once again asking for your dev time](https://i.imgflip.com/3t0aou.jpg)
Run v0.7.2 - Easily manage and invoke small scripts and wrappers
Tags: showdev, go, tools, github
Published: 2020-03-18 20:34:28

## About

Do you find yourself using tools like make to manage non build-related scripts?

Build tools are great, but they are not optimized for general script management.

Run aims to be better at managing small scripts and wrappers, while incorporating a familiar make-like syntax.

Quick Links: [Project Page ](https://github.com/TekWizely/run) | [Examples](https://github.com/TekWizely/run#examples) | [Installing](https://github.com/TekWizely/run#installing) | [Releases](https://github.com/TekWizely/run/releases)

---

## Project Update - v0.7.2

You can read about the new features and bug fixes below.

If you've been following run, I hope you'll find these updates useful.

If this your first time reading about run, and if you're at all interested in managing task runners and scripts, I hope you will give my project a try.

I am happy to answer any questions you might have.

Thank you,

-TekWizely

---

## New Features

### Assertions

Assertions let you check against expected conditions, exiting with an error message when checks fail.

Assertions have the following syntax:

```
ASSERT <condition> [ "<error message>" | '<error message>' ]
```

*Note:* The error message is optional and will default to `"Assertion failed"` if not provided

### Condition

The following condition patterns are supported:

* `[  ...  ]`
* `[[ ... ]]`
* `(  ...  )`
* `(( ... ))`

### Assertion Example

_Runfile_
```
##
# Not subject to any assertions
world:
	echo Hello, World

# Assertion applies to ALL following commands
ASSERT [ -n "${HELLO}" ] "Variable HELLO not defined"

##
# Subject to HELLO assertion, even though it doesn't use it
newman:
	echo Hello, Newman

##
# Subject to HELLO assertion, and adds another
# ASSERT [ -n "${NAME}" ] 'Variable NAME not defined'
name:
	echo ${HELLO}, ${NAME}
```

_example with no vars_
```
$ run world

Hello, World

$ run newman

run: Variable HELLO not defined

$ run name

run: Variable HELLO not defined
```

_example with HELLO_
```
$ HELLO=Hello run newman

Hello, Newman

$ HELLO=Hello run name

run: Variable NAME not defined
```

_example with HELLO and NAME_
```
$ HELLO=Hello NAME=Everybody run name

Hello, Everybody
```

*Note:* Assertions only apply to commands and are only checked when a command is invoked.  Any globally-defined assertions will apply to ALL commands defined after the assertion.

## Ignoring Script Lines

You can use a `#` on the first column of a command script to ignore a line:

_Runfile_
```
hello:
    # This comment WILL be present in the executed command script
    echo "Hello, Newman"
# This comment block WILL NOT be present in the executed command script
#   echo "Hello, World"
    echo "Goodbye, now"
```

*Note:* Run detects and skips these comment lines when parsing the runfile, so the `#` will work regardless of what language the script text is written in (i.e even if the target language doesn't support `#` for comments).
Firestore, get collection with async/await
Tags: todayilearned, firebase
Published: 2020-03-18 20:06:03

Today I Learned how to get all documents in a collection in [Firestore](https://firebase.google.com/docs/firestore/) with `async/await` and `for...of` by using the `.docs` property. 

Firebase documentation has examples with `.then` to get the result from a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).

```js
const logCities = () => {
  let citiesRef = db.collection('cities');
  let allCities = citiesRef.get()
    .then(snapshot => {
      snapshot.forEach(doc => {
        console.log(doc.id, '=>', doc.data());
      });
    })
}
```

But it can be written easier with [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)/[await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await).

```js
const logCities = async () => {
  let citiesRef = db.collection('cities');
  let allCities = await citiesRef.get();
  for(const doc of allCities.docs){
    console.log(doc.id, '=>', doc.data());
  }
}
```

I think this is more readable, two less lines and `.docs` allows us to use [`for of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of).
30+ things to do during Coronavirus outbreak
Tags: beginners, career, techtalks
Published: 2020-03-18 19:57:06

## Articles and guides

* [Text processing in the shell](https://blog.balthazar-rouberol.com/text-processing-in-the-shell)

* [Awesome PHPStorm](https://www.reddit.com/r/PHP/comments/cn2zsx/what_are_your_most_used_phpstorm_features_that/)

* [Developer roadmaps](https://roadmap.sh/)
  *  [Frontend](https://roadmap.sh/frontend)
  *  [Backend](https://roadmap.sh/backend)
  *  [DevOps](https://roadmap.sh/devops)

* [Programming guides](https://roadmap.sh/guides)

* [Design patterns for humans in PHP](https://github.com/kamranahmedse/design-patterns-for-humans)


## Talks 

* [Most popular TED talks of all time](https://www.ted.com/playlists/171/the_most_popular_talks_of_all)

* [PHP UK Conference](https://www.youtube.com/user/phpukconference)

* [PHP Serbia](https://www.youtube.com/user/PHPSrbijaVideo)

* [Webcamp Zagreb](https://www.youtube.com/user/WebCampZg)

* [Chaos Computer Congress](https://www.youtube.com/user/mediacccde)

* [Laracon Online](https://laracon.net/)

* [Security BSides London](https://www.youtube.com/channel/UCXXNOelGiY_N96a2nfhcaDA)

* [Security BSides San Francisco](https://www.youtube.com/channel/UCWemrSP6Aba171jXReCz_Qg)

[Linux Days Graz](https://www.youtube.com/user/grazerlinuxtage)

## Projects 

* [Write yourself an interpreter and compiler in Go](https://interpreterbook.com)

* [Linux From Scratch](http://www.linuxfromscratch.org/)
<br/><br/>

## [See complete list of recommendations](https://mariokranjec.dev/posts/awesome-things-to-do-during-coronavirus-outbreak)
Build a WhatsApp Clone with Ionic 2, Angular 2, and Meteor!
Published: 2020-03-18 19:41:12

![](https://github.com/the-guild-org/oneblog/blob/master/img/704/1*ePy_CSbglLEynzp104qiCw.png?raw=true)

_A version of this post was originally published on the [Ionic Blog](http://blog.ionic.io/build-a-whatsapp-clone-with-ionic-2-angular-2-and-meteor/)._


Now, a year has passed and a lot has happened: Angular 2.0 is now stable, including astonishing amount of new features for the platform. Ionic 2.0 entered RC stage and is very close to being final. Finally, Meteor [reached version 1.4.2](http://info.meteor.com/blog/announcing-meteor-1.4.2), with many improvements the community asked for (fast build times, full npm and yarn support, Node 4.6.1 and MongoDB 3 by default, etc..).


## New Ionic/Meteor Whatsapp Tutorials

Today, I’m happy to announce we are releasing two new versions of the Ionic/Meteor Whatsapp tutorial, this time with Angular 2.0 and Ionic 2.0, one using the **Ionic CLI** and one using the **Meteor CLI.**


In these tutorials, we’ll create a full WhatsApp clone using Angular 2 and Ionic 2. We’ll use Meteor’s realtime collections for the chat and Meteor’s simple Authentication packages for SMS-based authentication.

It’s great to see the power of these two solutions working together, keeping the platforms up-to-date with the latest improvements in the Javascript ecosystem!

## Angular2-Meteor

By the way, if you noticed that the [Angular-Meteor.com](https://angular-meteor.com/) website is much faster, it’s because we’ve completely re-written it using Angular 2 and universal rendering to generate it as a static website. On top of that, more features are coming to Angular2-Meteor very soon, including lazy loading of modules and support for the AOT compiler.


If you’re thinking about migrating from Blaze to Angular2, or using them side by side, check out our [migration tutorial here](https://angular-meteor.com/tutorials/migration/angular2/introduction).