teleren/devto huggingface dataset:
react-select + allOption
Tags: react, javascript
Published: 2017-08-19 02:22:11

---
title: react-select + allOption
published: true
description: Give users of the fine component react-select the ability to select all options with a single click
tags: reactjs, javascript
---

If you are using the React library [react-select](https://github.com/JedWatson/react-select), you will find it doesn’t implement a “select all” option. It’s not difficult to implement this feature by yourself, just have a look at the following gist. You will even find how to make a localization wrapper on top of your control, in case you need it. 

Take a look at the relevant stuff:

```javascript
// specify props.allowSelectAll = true to enable!
const Select = props => {
  if (props.allowSelectAll) {
    if (props.value.length === props.options.length) {
      return (
        <ReactSelect
          {...props}
          value={[props.allOption]}
          onChange={selected => props.onChange(selected.slice(1))}
        />
      );
    }

    return (
      <ReactSelect
        {...props}
        options={[props.allOption, ...props.options]}
        onChange={selected => {
          if (
            selected.length > 0 &&
            selected[selected.length - 1].value === props.allOption.value
          ) {
            return props.onChange(props.options);
          }
          return props.onChange(selected);
        }}
      />
    );
  }

  return <ReactSelect {...props} />;
};
```

You will find the full gist at:

https://gist.github.com/AlexEscalante/251032be95767366742fce75bdfa269b

Please drop a line if you find this useful or have any comment!
Explain Monads Like I'm five
Tags: explainlikeimfive, discuss
Published: 2017-08-18 21:34:52

---
title: Explain Monads Like I'm five
published: true
description: Explain what monads are to a five-year-old
tags: explainlikeimfive, discuss
---

Ok you knew this was coming, did you? Explain monads!
What's the hardest problem you've had to debug recently, and what did you learn from it?
Tags: discuss
Published: 2017-08-18 21:30:33

---
title: What's the hardest problem you've had to debug recently, and what did you learn from it?
published: true
tags: discuss
---

Mine was a problem with a React app. I was loading an SVG icon sheet using XHR, and dynamically prepend it to the `<body>` tag's content. This was done lazily, the first time an Icon was rendered.

I was trying to put a grid of actions, each of which has an icon, into an Accordion component. The accordion would work with any other content, but when I added the icon grid, it would just not respond. I first started looking for the cause by inserting an SVG in the accordion directly, without the `<use>` SVG tag, and that worked. Then I loaded my sprite sheet, and inserted a `<svg><use ... /></svg>` tag, and it stopped working. I was tearing my head out, until at one point while having lunch, the cause popped into my head. Here's how I was fetching and inserting my sprite sheet:

```
fetch(location.origin + "/api/icons", {/* ... options ...*/}).then((resp) => {
    return resp.text();
}).then((svg) => {
    document.body.innerHTML = svg + document.body.innerHTML;
});
```

The problem was that doing this removes all the event listeners from the page, as you're basically recreating the entire DOM from a string.

Here's what my code looks like now:

    fetch(location.origin + "/api/icons", {/* ... */}).then((resp) => {
        return resp.text()
    }).then((txt) => {
        let div = document.createElement("div");
        div.innerHTML = txt;
        document.body.insertBefore(div.firstChild, document.body.firstChild)
    });

So I'm inserting the SVG I get from the server as text into a newly created div element. Then, I insert the contents of that div, right before the first tag in the body. The important thing, is that I'm actually inserting the SVG element as a DOM node, not as text. This way, the DOM stays intact, and the event handlers still work. hurray! ðŸŽ‰

Now it's time to tell your stories from the debugging battlefield.
Forming a programming career
Tags: discuss, career, beginners
Published: 2017-08-18 18:53:34

---
title: Forming a programming career
published: true
description: 
tags: discuss,career,beginners
---

Being a computer science student is kinda hard, not because the classes, but because I'm completely lost in what I want to do with my professional live after university. And when I say lost... I REALLY mean it.

I am currently working in web. We are asked to do both front and back end. We use JavaScript, C# WebServices and SqlServer. I just love doing C# and SQL, but I really hate the JavaScript/jQuery/Angular/CSS/HTML part which is like the 70% of work that I have.

I am afraid of getting stuck in this situation. I really like programming in C, C++, Java, C++, Sql, doing Arduino proyects, learning about algorithms, AI and I currently signed up for an Assembly class in the University. I just cant imagine my future doing web programming.

I just don't know where to start to start doing what I like. What type of career should I start forming?

I would love to read personal experiences from you guys. Thanks for reading.
As we should think
Tags: discuss, beginners, career, life
Published: 2017-08-18 14:25:03

---
title: As we should think
published: true
description: Their idea to use computers wasn’t to make life easier, it was to enhance our intellect
tags: discuss, beginners, career, life
cover_image: https://thepracticaldev.s3.amazonaws.com/i/uuy9pjdr1hz6xsq5sfrl.png
---

[Douglas Engelbart](https://en.wikipedia.org/wiki/Douglas_Engelbart) was an early computer pioneer. He was inspired by an article wrote in 1948 by Vannevar Bush “[As We May Think](https://www.theatlantic.com/magazine/archive/1945/07/as-we-may-think/303881/)“. Their idea to use computers wasn’t to make life easier, it was to enhance our intellect, to make us better, to improve the tools that we have to make us better as human beings. Regrettably computers had a different effect on the human race, we love sharing our pets photos, we love watching funny videos on the web and that’s about it. I wonder if could ever change the way we use the great tools that were built for us.

We have no more excuses! The world's knowledge is available to you. Some people might blame social networks, games, etc but the issue is not the car, the problem here is the driver! The content is there for anyone go get it, specially now, you can find information on anything for free..at home..on your own time. Basically, if technology it’s making us stupid it’s not technology’s fault, it’s ours.

![alt text](https://thepracticaldev.s3.amazonaws.com/i/51k8tersqy25kh49uqtg.png "1968")
Vampires today
Tags: vampire, developer, humor, tech
Published: 2017-08-16 23:48:41

---
title: Vampires today
published: true
description: How would a vampire developer live?
tags: vampire, developer, humor, tech
---

# How would a vampire live today?

After working in some illustrations of vampires, an idea came to me. Thanks to technology, how would a vampire live today?

Vampires have several issues, such as not being able to go out in daylight or not being able to watch themselves in mirrors. But thank to technology, their horrorous life could be easier.

- **Mirrors** have always been a problem to vampires, not anymore. Thanks to a touchscreen,a webcam and an raspberry pi, any vampire would be able to see himself/herself. The easy way would be to connect simply the camera to the front in order to show what’s in front of it. Always ready, vampire!

- Vampires can’t bare **sunlight**, some developers share this too. But if you are a vampire developer, is even worse. What can you do? You can ask for food and supplies online, earn a degree online and basically work online. Now there’s no way you can escape from your responsibilities if you are a vampire.

- Vampires are **immortal**, this is a horrible thing regarding to documents and bureaucracy. But fear no more, because internet gives you a gold chance to be anonymous online. You can create a privacy wall surrounding your-digital-self and use digital currency, such as bitcoins.

- Need **blood**? this is tedious, going to chase humans and stuff. No problem because there are already blood substitute, synthetic options. You can go all vegan-vampy.

- Sorry about the garlic, tho.

- Afraid of **vampire hunters** chasing you in your room? You can build an arduino detector in your room, based on moving sensors, that blocks your coffin. You can even install a screen inside the coffin to unlock it in case of emergency.

Well this is pretty much it. Get to work, vampire, never is late to join tech!
Meet Our New West Coast Developer Advocate
Tags: developeradvocate, devrel, career
Published: 2018-02-10 22:35:00

---
title: Meet Our New West Coast Developer Advocate
published: true
tags: developer advocate,devrel,career
canonical_url: https://www.sparkpost.com/blog/west-coast-developer-advocate/
---

Hello everyone! ðŸ‘‹ Avi here. I’ve got exciting news about my role at SparkPost!

### TL;DR:
{% twitter 895313651669712900 %}

Last summer, I joined SparkPost as an [intern](https://www.sparkpost.com/blog/engineering-interns-intro-2016/) on the Growth Engineering team. I was lucky enough drop the _“intern”_ part of my title in September of last year, and I’ve gotten to work on some pretty [interesting stuff](https://www.sparkpost.com/blog/author/agoldman/).

Now, one year later (drumroll please) I’m psyched to say that I’m joining the Developer Relations team as the west coast Developer Advocate in San Francisco. ðŸŽ‰ I’ve gotten to work with [Mary](https://twitter.com/mary_grace) and [Aydrian](https://twitter.com/aydrianh) during my time here and I’m thrilled to join them full time.

I visited SF for the first time after [AngelHack Silicon Valley](http://angelhack.com/angelhack-global-hackathon-series-silicon-valley/) a couple of weeks ago and I’m already a little in love with the city.

{% twitter 892181717372477440 %}

I’ve got a ton of ideas that I hope to share about email and making it a little more fun. I’ve got some tooling for front-end work that I’m playing with because let’s face it – HTML emails are hard. (If you want to help, let me know ðŸ’Œ)

After that, who knows! I want to work on email testing and validation tools, integrations with some awesome projects, and some fun demos and guides. Right now, I’m toying with the idea of checkers built with interactive email and SparkPost.

I’m going to be traveling to more events now as well (though I’ve managed to go a good number as an engineer) so if you see me, say hi! I absolutely love going to hackathons, so if you have any suggestions there let me know!

In any case, I’m new to the Developer Advocacy side of things, but I’m super excited for this adventure. If you have any tips or tricks for living in SF or traveling, tweet em at me ðŸ˜¬

If you want to talk, you can find me on [Twitter](https://twitter.com/theavigoldman), [Github](https://github.com/avigoldman), or [email](mailto:avi@sparkpost.com) â¤, and I’m always up for a cup of coffee.

_This post was originally published on [sparkpost.com](https://www.sparkpost.com/blog/west-coast-developer-advocate/)_
Explain Big(O) Notation
Tags: explainlikeimfive
Published: 2017-08-18 09:11:03

---
title: Explain Big(O) Notation
published: true
description: Explain Big(O) Notation
tags: ExplainLikeImFive
---

I believe I have the understanding, however I just want to double check with a community of developers. Good source links are recommended.
scootalite - the opensource podcast manager
Tags: react, showdev, php, podcast
Published: 2017-08-18 08:41:22

---
title: scootalite - the opensource podcast manager
published: true
description: a side project of mine, looking for collaborations
tags: reactjs, showdev, php, podcast
---

Hi there guys, I have been working for the last months on an idea, a centralized podcast manager webapp tool (that is a lot of words), that would allow me to add podcasts as rss feeds, and the listen to them, save the position I was in, download the files, add favourites, share bits and suff like that.

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

I firstly wrote it in jquery, then in angularjs 1.5, then in vuejs, finally in react, not because I am mental, but because I love to test new things I am learning on some project that I actually care about.

I would like to hear some opinion and have some collaboration if someone is interested in it. I dont want to monetize it or anything, I want it to be opensource and free, ads-free forever. I am not a startup guy, I am just a guy who made a tool for his needs.

I will drop some links so you can check it out:
### Latest Version (reactjs)
[scootalite](https://scootalite.surge.sh)
### Other Version (vuejs)
[ascoota](https://ascoota.surge.sh)

## Code
[scootalite web - github](https://github.com/vikkio88/scootalite) (reactjs)
[scootalite api - github](https://github.com/vikkio88/scootalite-api) (php7, slim [slime](https://github.com/vikkio88/slime))
Best iOS resources for an experienced dev?
Tags: discuss, android, ios, career
Published: 2017-08-18 08:36:09

---
title: Best iOS resources for an experienced dev?
published: true
description: An Android developer branches out
tags: discuss, android, iOS, career
---

I'm an experienced Android developer, but I'm looking at branching out into iOS development too. Has anyone here done the same? What are some good resources for learning iOS? What challenges did you face when you started working on iOS?
Контейнеризация PHP-Приложения с помощью Docker
Tags: php, docker
Published: 2018-01-25 20:26:50

---
title: "Контейнеризация PHP-Приложения с помощью Docker"
published: true
tags: php, docker
canonical_url: http://phpprofi.ru/blogs/post/67
---

Среди многих проблем, при современной разработке программного обеспечения, существует проблема гарантированно одинакового исполнения ПО во всех окружениях.

![](http://www.cloudways.com/blog/wp-content/uploads/Containerize-your-PHP-Applications-Using-Docker-1.jpg)

И для решения оной, Docker приходит на помощь! Он предоставляет единый способ построения и запуска контейнеров для любых необходимых сервисов. Платформа гарантирует, что ваше приложение отработает одинаково вне зависимости от конечного окружения.

Чтобы продемонстрировать процесс Docker-изации PHP-приложения, я буду рассматривать блог, изначально разработанный на фреймворке Laravel 5.4.

Читать далее: http://phpprofi.ru/blogs/post/67
Explain Service Discovery like I'm five
Tags: explainlikeimfive, discuss
Published: 2017-08-17 21:51:21

---
title: Explain Service Discovery like I'm five
published: true
description: 
tags: 
- explainlikeimfive
- discuss
---
Everytime I try to clarify the concept of Service Discovery, the google endeavor gets *way* to technical, too fast. For example, what part of DNS handles Service Discovery? And how does that differ from the way like Consul handles it? The confusion is real.
Checking if the column was updated inside SQLServer update trigger
Tags: sqlserver, database, triggers
Published: 2017-08-17 21:22:27

---
title: Checking if the column was updated inside SQLServer update trigger
published: true
description: 
tags: SQLServer, databases, triggers
---

There are three ways one can check if a column was updated inside a trigger:
1. Check for the value of UPDATE(Column_Name)
2. Check for the value of COLUMNS_UPDATED() & integer mask for the column updated (also works for more than one column)
3. Check if a column appears in an inserted table -  IF EXISTS(SELECT Column_Name FROM inserted) 

However these three do not work in the same way.

Example:
We have a table dbo.Customers and we want to check for updates on its first column, LastName. We will create a trigger which will incorporate all three of the methods. It will print a message for each condition that was met:

```sql
CREATE TRIGGER [dbo].[CustomersUpdateTrigger]
ON [dbo].[Customers]
AFTER UPDATE
AS
  BEGIN
      IF UPDATE(LastName)
        PRINT 'UPDATE(LastName)'

      IF ( COLUMNS_UPDATED () & 1 = 1 )
        PRINT 'COLUMNS_UPDATED ( )  & 1'

      IF EXISTS(SELECT LastName
                FROM   inserted)
        PRINT 'EXISTS(SELECT LastName FROM inserted)'
  END
```

Now let's run a rather specific update statement against the Customers table:
```sql
UPDATE dbo.Customers
SET    lastname = 'SomeNewLastName'
WHERE  0 = 1  
```
Clearly, no row is going to be updated. How many messages are we going to see?

```
UPDATE(LastName)
COLUMNS_UPDATED ( )  & 1

(0 row(s) affected)
```
Conclusion: Checks for UPDATE() and COLUMNS_UPDATED () return true if a column we check for was in an update list, regardless of an actual data update. For the IF EXISTS(SELECT Column_Name FROM inserted) check we need some actual data to be updated.

Microsoft docs references:
[UPDATE()](https://docs.microsoft.com/en-us/sql/t-sql/functions/update-trigger-functions-transact-sql)
[COLUMNS_UPDATED](https://docs.microsoft.com/en-us/sql/t-sql/functions/columns-updated-transact-sql)
Side Projects are Hard.
Tags: projects, webdev, beginners
Published: 2017-08-17 20:31:55

---
title: Side Projects are Hard.
published: true
description: momentum is everything.
tags: projects, web development, beginners
---
This summer has been a fast paced one where I jammed multiple time consuming goals into 2 months. I took up a “Build To Learn Project in the Chingu Cohort Ecosystem to push the boundaries of my basic web development skills as well as picking up a part time job, learning how to drive, and reading 5 novels. Going in, I believed that these goals on top of my school work would be challenging, but at the same time completely controllable. I began the web development project with two other cohort participants and jumped right into the project. But as I soon learned, keeping momentum on a project with no vital deadlines or end standards is difficult, and takes a LOT of discipline. I struggled to keep on contributing to the project regularly and eventually had a period of pure inactivity. But after coming back from that I have a newfound maturity towards the responsibility I have in finishing what I have started. A lot of people on the path of learning web development have a habit of not finishing the things they have started for one reason or another, but I now believe in focusing on proficiency and on the learning aspect during the work rather than on my mental image of a perfect project. As the summer is winding down, I am happy to report that I have reached all of my summer goals successfully! I learned this summer that a little bit of grit and self discipline can go a long way.
This Week, I will be focusing on tying up loose ends on my side project, reviewing C++ to prepare for the fall, and learning React.js to prepare for my next project(s). Thanks for reading!
Are covers letters important to apply for a job?
Tags: discuss
Published: 2017-08-17 15:42:17

---
title: Are covers letters important to apply for a job?
published: true
description: The first topic about cover letter.
tags: discuss
---


I'm from Venezuela and here are unusual the cover letters, here is enough only your CV to apply for any job, but after one year working remote, home based, for different companies that I didn't send a cover letter, are these important?
Pisatel.rb - a blogging engine in Ruby
Tags: showdev, ruby
Published: 2017-08-17 15:15:43

---
title: Pisatel.rb - a blogging engine in Ruby
published: true
description: A showcase of my Ruby blogging engine.
tags: showdev, ruby
---

I built a very simple blogging engine with Ruby, Sinatra and GraphQL. I'm trying to create a lightweight Ghost alternative so the look of the default theme is Ghost'y.

Features/Pros:
* You can... write posts. In markdown. In a nice real-time preview editor (thanks to those who open-source their cool projects. The markdown editor I use called simple-markdown-editor).
* It uses Vue.JS.
* Sqlite/mysql/postgres support (Sequel can handle more but I'm not trying to provide support for all the existing databases, so I picked the most popular).
* Dockerized (with docker-compose).
* It has a first-time setup page where you can configure your database stuff (host, port, db name, etc).

Cons:
* It's an alpha. I haven't tested postgres support yet. There may be bugs.
* It does not use a cool framework like Ruby on Rails (I don't find it a con actually, but keep in mind that the code/project structure may look ugly a bit).
* It's not that easy to contribute to it because of see above.


I'm looking for:
* Ideas!
* Bug reports!

[Github page](https://github.com/Defman21/pisatel.rb).

The demo will be soon.

Built with pain, tears, blood and love by me.
The "show-devto" Tag
Tags: discuss
Published: 2017-08-17 14:08:17

---
title: The "show-devto" Tag
published: true
description: Should we have it or not?
tags: discuss
---

If you're a HackerNews user, you should know that they have an interesting category called "Show HN" where people shows their projects. I've found a bunch of interesting projects in this category and maybe we should add something like that on dev.to as well? I'm sure there are lots of developers who would want to share their projects and get some popularity/ideas/bug reports/etc. 

What do you think?
Explain how to read/write bezier curves like I'm five
Tags: explainlikeimfive, discuss
Published: 2017-08-17 13:48:47

---
title: Explain how to read/write bezier curves like I'm five
published: true
description: 
tags: explainlikeimfive, discuss
---

CSS has `transition-timing-function: cubic-bezier(w, x, y, z)`. SVG supports bezier curves (and they render really fast).

I've seen pictures like this:

![bezier graph example](https://thepracticaldev.s3.amazonaws.com/i/x1kvb2quxwy1d85ofbaj.jpg)

But I've never understood how to read a bezier curve function or how to write one by hand (does anyone write these by hand?)

To make this a little more useful, let's say I'm a five-year-old that has a fair understanding of algebra and plane geometry.
GitHub on the go?
Tags: github, code, beginners, discuss
Published: 2017-08-17 12:03:04

---
title: GitHub on the go?
published: true
description: 
tags: github, code, beginners, discuss
---
Do you use a mobile app for Github? I'm trying to implement some code-reading time, and having access from my phone sounds like a good plan. 
Thoughts? 
-Ryan