teleren/devto huggingface dataset:
What is a POSIX BRE compliant regex?
Tags: posixbre, posix, regex
Published: 2020-04-30 20:55:13

---
title: What is a POSIX BRE compliant regex?
published: true
description: little note on what a POSIX BREE compliant regex is
tags: posix bre, posix, regex
---

POSIX is the acronym for “Portable Operating System Interface for uniX”. It is a collection of standards. This collection define some of the functionality that a (UNIX) operating system should support.

BRE stands for Basic Regular Expressions or BRE, and standardize a flavor similar to the one used by the traditional UNIX grep command.

A BRE supports POSIX bracket expressions, which are similar to character classes in other regex flavors, with a few special features.

In regex a series of shorthand character classes are available. \d is short for [0-9]. In POSIX BRE shorthands are not supported.

The BRE a{1,2} matches a{1,2} literally, while a\{1,2\} matches a or aa.

Some implementations support \? and \+ as an alternative syntax to \{0,1\} and \{1,\}, but \? and \+ are not part of the POSIX standard.

Tokens can be grouped with \( and \).

Backreferences are the usual \1 through \9. Only up to 9 groups are permitted. E.g. \(ab\)\1 matches abab, while (ab)\1 is invalid since there’s no capturing group corresponding to the backreference \1. Use \\1 to match \1 literally.
Submitting Octwilio to the Twilio x DEV Hackathon!
Tags: devops, twilio, octopus, twiliohackathon
Published: 2020-04-30 20:41:57

---
title: Submitting Octwilio to the Twilio x DEV Hackathon!
published: true
description: My submission to the Twilio x DEV Hackathon!
tags: devops,twilio,octopus,twiliohackathon
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/wb4bp2r9wddlij54r62n.jpg
series: Building Octwilio
---

## What I built <a name="what-i-built"></a>
#### Category Submission: Interesting Integrations

Octwilio combines the Octopus Deploy and Twilio APIs. Twilio sends messages when certain events in Octopus happen. Responses to those messages can invoke requests to the Octopus API.

For example, if a deployment requires approval, Octwilio uses the Twilio API to send an SMS to a chosen approver. The approver can then reply to the SMS with "Approve" or "Reject." Octwilio accepts the message from Twilio and uses the Octopus API to update the state of the deployment.

## Screenshot <a name="screenshot"></a>

I do not have a publically available demo link, but please enjoy this screenshot of Octwilio in action.

You can see a message announcing the deployment has started. After that, there is a message letting me know that the deployment requires approval. I reply with a very official "looks good to me." I get a notification that the deployment was approved, and finally that it was successful.

![Series of messages to and from Twilio](https://dev-to-uploads.s3.amazonaws.com/i/4isudwjhxa83eypm6o4e.jpg)

## Link to Code <a name="link-to-code"></a>

The code and configuration instructions are hosted on GitHub.
{% github ryanrousseau/octwilio %}

## How I built it <a name="how-i-built-it"></a>

I built Octwilio with Firebase Cloud Functions. Cloud Functions are Node-based serverless functions that fire on specific events. Octwilio uses functions that trigger on HTTP requests. These functions are the glue between the Twilio and Octopus Deploy APIs.

The details on how I built Octwilio are in earlier posts of this series. Start with the [first one](https://dev.to/octopus/octwilio-combining-the-octopus-and-twilio-apis-for-twiliohackathon-1846)!

## Additional Resources/Info

[Twilio](https://www.twilio.com/)
[Octopus Deploy](https://octopus.com/)
[Firebase](https://firebase.google.com/)

_Cover photo by [Benjamin Davies](https://unsplash.com/@bendavisual) on [Unsplash](https://unsplash.com/)._
Integrating Finnhub.io with Twilio
Tags: twiliohackathon, twilio, finnhub
Published: 2020-04-30 20:33:31

---
title: Integrating Finnhub.io with Twilio
published: true
description: My submission to the Twilio x DEV Hackathon!
tags: twiliohackathon, twilio, finnhub
---

## What I built
I built a Integration for Twilio to get the current stocks quote from my favourite api Provider.

As there was no app using the already published api from Finnhub that fitted my Needs, I thought this would be the perfect fit.

Instead of making a complete app myself, I decided to use this correlation, to use a Twilio Integration. The result should work on-the-go, be easy to use, be easy to implement and most importantly, work in rural Areas without excessive mobile Network Access.

This were the reasons to use the Twilio Service with SMS capability.
The result fitted all my needs, was easy to create and even works without Internet Access. In the end using SMS for the request initiation fitted perfectly.

## Category Submission: 
Interesting Integrations

## Link to Code
https://github.com/moagggi/twilio-dev_to

## How I built it
I used the awesome prebuilt official PHP SDK from Twilio with no issues, as well as the inbuilt PHP functionality.

## Additional Resources/Info 
To successfully deploy the project you need a self controlled PHP environment, as well as an API-Key from Finnhub.io (get one there, it's free).
A glance at... 
Tags: react, javascript, webdev, beginners
Published: 2020-04-30 20:02:48

---
title: A glance at... 
published: true
description: Some short posts for beginners
tags: #react #javascript #webdev #beginners
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/wal1o73e38bqcb86ig53.png
---

Not so long ago I started to code... 

One of the main issues I had was to find short posts with simple examples, just to have a general idea of what I was trying to learn. 

Knowing that my learning process is understanding the general idea of a concept and practising first, then diving deeper into it,I was often confronted with long and too complex posts. I'm not saying they weren't good, but they were too advanced for my level and made me raise too much questions instead of resolving the few I had - which usually were 'What is this concept ?', 'How does this concept works ?', 'How can I use it ?'.

This is why the posts 'A glance at...' will try to answer at these questions, with simple examples, hoping it will help some beginners :)

## A glance at...
 1. [...useEffect](https://dev.to/stel/a-glance-at-useeffect-1dhl)

✌️
Submission - Whatsapp COVID stats bot
Tags: twiliohackathon
Published: 2020-04-30 19:59:21

[Comment]: # (All of this is placeholder text. Use this format or any other format of your choosing to best describe your project.)

[Reminder]: # (Make sure you've submitted the Twilio CodeExchange agreement: https://ahoy.twilio.com/code-exchange-community)

[Important]: # (By making a submission, you agree to the competition's terms: https://www.twilio.com/legal/twilio-dev-hackathon-terms)


## What I built

I built a whatsapp chatbot which gives the information about the current covid status around the world and India and also the specific stats about the states in the India. 

In order to make it more interesting , I made use of the geolocation api help from google maps to get hospitals from the user's location with radius of 1.5 kms.


### How I built it 

I made use of the twilio's whatsapp api to create a bot with python's flask framework as backend.

![Screenshot 2020-05-01 at 1 23 31 AM copy](https://user-images.githubusercontent.com/23126394/80753282-a167da00-8b4a-11ea-96ab-68bec6c3011d.png)

GITHUB _ REPO link : [codebase]( https://github.com/skarthikeyan96/whatsapp-covid-stats/ )
A glance at useEffect
Tags: react, javascript, webdev, beginners
Published: 2020-04-30 19:57:24

---
title: A glance at useEffect
published: true
description: * Short posts for beginners *
tags: #react #javascript #webdev #beginners
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/ipdcox6xm836p2j8abk3.png
---

### What's useEffect for ?
useEffect is a hook you'll need if you want to handle side effects in a functional component. 

Side effects are code running after React has updated the DOM.

### An example please ?!

```react
import React, { useState, useEffect } from "react";
import "./styles.css";

export default function App() {
  const [count, setCount] = useState(0);
  const [style, setStyle] = useState("#A5CE86");

  const change = () => {
    setCount(count + 1);
  }

  const color = "#F98E72";

  useEffect(() => {
    setTimeout(() => {
      setStyle(color);
    }, 2000);
  }, [color]);

  return (
    <div>
      <h1 style={{ color: `${style}` }}>{count}</h1>
      <button onClick={change}>Change!</button>
    </div>
  );
}
```
### Ok... what do we have here ?

This code shows a counter. Each time you click on the button, the `count` will increase by 1. And there's a little color changing side effect...

1.The component is shown to me for the first time:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cb17ukqfa0kb2brb37wd.png)

2.After the DOM is rendered, my component run the side effect... :
```react
useEffect(() => {
    setTimeout(() => {
      setStyle(color);
    }, 2000);
  }, [color]);
```
3.... and change the value of my `style` state:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wsdxofklnwnwilqys0rd.png)

4.I click on the button:
```react
 <button onClick={change}>Change!</button>
```

5.It increases my state `count` by `+1`:

```react
 const change = () => {
   setCount(count + 1);
 }
```

6.React update the DOM :
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/slc6auw8kajnpdpopiyv.png)

7.After the DOM is updated, my component does't run the side effect because I told him to run it only if `color` changed, by adding a dependencies to useEffect: 
```react
  useEffect(() => {
    setTimeout(() => {
      setStyle(color);
    }, 2000);
  }, [color]); //my dependency
```

You can add a console.log into the `setTimeout()` method and run the code. You will see that React run the side effect only one time thanks to the dependency. Now try to remove it, and you will see the side effect is running every time my component is updated.

### What now ?

It was a glance at useEffect. To dive deeper into this concept have a look at: 
 - [Reactjs documentation](https://reactjs.org/docs/hooks-effect.html) 
 - [Dan Abramov's blog post] (https://overreacted.io/a-complete-guide-to-useeffect/)


Hope you enjoyed this post and will close this window with a better understanding of useEffect.

✌️
The program that alows you to know wich files you can put
Tags: replit, python, USB, file
Published: 2020-04-30 19:55:06

Thei i s la tittle program based on an exercise of lycée that alows to knox for a givne amount of files and a given amount of space which files can fint in this space and which can't.

{% replit @HanraLatalliar/Probleme-cartable %}
#WebDev on web.dev - Add archived newsletters to /newsletter #2725 (Part 2)
Tags: webdev, javascript, opensource, frontend
Published: 2020-04-30 19:48:39

{% youtube ULTSeVaqQQI %}

Hey y'all, my name is Michael and I'm one of the engineers who works on Google's [web.dev](https://web.dev/) site.

On April 30 at 1 PM PST I'll be doing some coding of the site live on YouTube and would love for you to join in.

We'll be picking up where we [left off previously](https://dev.to/michaelsolati/webdev-on-web-dev-add-archived-newsletters-to-newsletter-2725-2p0) the other day.

On web.dev you're able to subscribe to a monthly newsletter from some pages. The newsletter isn't available anywhere else though! So if you missed an email there is no way to see it. Well, we can fix that. In this stream we'll look at hosting these newsletter emails as pages on web.dev.

[(Join the chat here)](https://youtu.be/ULTSeVaqQQI)
My First Release: JS Query
Tags: javascript, jquery, github, release
Published: 2020-04-30 19:47:54

---
title: My First Release: JS Query
published: true
description: 
tags: javascript, jquery, github, release
---
I started tinkering with the concept of [_replacing jQuery_](https://dev.to/edlinkiii/refactoring-jquery-2klg) a while back, and I've finally _finished_ it. Not really, I just started making major changes to it and decided I should put out a 1.0 release of it in it's current state. (Luckily, GitHub makes that pretty easy.)

Honestly, it all started with me not wanting to change `el.hasClass()` to `el.classList.contains()`!

The most important thing to me in writing this was to make sure it was completely compatible with Vanilla JavaScript:
`$q('#my_id').textContext('Hello World')`

The second most important thing was to make as many of the calls as possible (and made sense to be) chainable:
`el.removeClass('active').addClass('blue')`

It is being used in **production** in one of my current employer's applications. However, I write code for a _controlled environment_ - this library is not exactly IE safe. Personally, I've never tested it to see what all would break (if someone would like to do that and update the docs, cool!), but it is pretty dependent on _modern_ browsers and their ability to use _modern_ JavaScript.

I hope you enjoy playing with it as much as I enjoyed writing it.

So, here it is, for your consideration: [JS Query v1.0](https://github.com/edlinkiii/js-query/releases/tag/v1.0)
JavaScript Arrays
Published: 2020-04-30 19:38:26

Every language has their own array. But Java has a special place in my heart. While it is similar to Ruby in my experience. There are different methods that would help with you learning JavaScript. 

Like any other arrays, the index of an array will always start at 0, and increment by 1. 

First you have your common methods such as **push(), pop(), shift(), reverse()**

Push -> This method will allow you to add an element to the end of the array

Shift -> This method removes the first element of the array

Pop -> This method removes the last element of the array

reverse -> This method will change the whole array order in reverse.

However there are some methods that can help you iterate through a whole array.

We have methods such as **forEach(), and map()**

forEach -> Executes a function that is used for every element in the array
<img src=https://i.imgur.com/gWVj8pJ.png>

map -> Returns a new array that is filled by the function that is being called on each element of the array
<img src=https://i.imgur.com/KBzJxTo.png>

Knowing these arrays method would help you get through the basics of JavaScript and it is what I used the most on the daily.
Rail Setup
Tags: rail
Published: 2020-04-30 19:26:02

      ## Rail Setup
        $ rails new <app>
        * $ bundle update - this will update the GEM, already created in first command
        $ rails generate scaffold username:string password:string
               1. $ rails generate scaffold recipe
        $ rake db:migrate RAILS_ENV=development
        $ rails db:migrate - run the script on the local server
        $ rails new <app>
        $ bundle update - this will update the GEM, already created in first command
        $ rails generate scaffold username:string password:string
        $ rails generate scaffold recipe
        $ rake db:migrate RAILS_ENV=development
        $ rails db:migrate - run the script on the local server

        $ Inside HTML
          <% tweet = Tweet.fin(1) %>  this will not be shown on the HTML
          <h1><%= tweet.status %></h1>  this will print on the HTML screen

        $ layout 
          to the /app/views/layouts/application.html.erb/
          <html>
              <body>
                <%= yield %>   {this will take all the other page &rest layout }
              </body>
          </html>


      ### Chapter 1 <a name="chapter-1"></a>

## Scaffold 
        * $ rails new <app>
        * $ bundle update - this will update the GEM, already created in first command
        * $ rails generate scaffold username:string password:string
        * $ rails generate scaffold recipe
        * $ rake db:migrate RAILS_ENV=development
        * $ rails db:migrate - run the script on the local server
Change to Config/routes.rb by -: 
## Destroy Scaffold & Text Genration
        $ root to: 'users#index'
        $ get 'about', to:'pages#about'
        $ $ rails -s -: run the application
    
        $ rails destroy scaffold <app> or rails d scaffold books - Destroy
        $ rails generate controller pages index contact about -: generate the controller
        $ rails new myapp --database=postgresql
        $ render plain: 'hello'
        $ puts 'hello'

## Calling the Gem for rest-client(API)
        $ gem install rest-client
        $ bundle update

        $ rails routes
        $ rails generate model book title:string author:string
        $ rails generate controller book
### 


## Debug

    1. <%= debug(params) %>
    2. <%= debug(@data) %>
    3. rails c
    4. Google Developer
    5. buy bug
    6. Pry Gem 
### 


Error :uninitialized constant LoginController Did you mean? LoginsController
Change delete 'logout', to: 'login#destroy' to delete 'logout', to: 'logins#destroy


rails new myApp --skip-active-record
https://codeburst.io/how-to-build-a-good-api-using-rubyonrails-ef7eadfa3078
A simple way to count from 0 to 99 on your hands
Published: 2020-04-30 19:24:20

Start with all fingers down. `ooooo` This is zero. 

Put your index finger up. `o1ooo` This is one. You probably already knew that and have been doing this since before you could speak in sentences. But unlike your grade school counting method that only reaches 10, we will make one small modification to reach 99! So let's get on with the parts we already know:

- `o11oo` two.
- `o111o` three.
- `o1111` four.
- `11111` five.

And stop. Normally, we would keep going onto the next hand, but let's keep this hand counting by putting fingers down in the same order we put them up. So, from all five fingers up:

Put your index finger down. `1o111` This is six.
Put your middle finger down. `1oo11` This is seven.
Put your ring finger down. `1ooo1` This is eight.
Put your pinky down (only your thumb should be extended now). `1oooo` nine.

Hopefully you've gotten the pattern. Now you can start using your left hand for the tens digit.

Put your index finger up on your left hand and put your thumb back down on your right hand. `ooo1o` `ooooo` This is ten.

And with just two hands and a simple counting strategy we can represent any number from 0 to 99!

Some examples:

- 42: `1111o` `o11oo` all fingers (but not thumb) up on left hand; index and middle finger up on right hand.
- 69: `111o1` `1oooo` middle, ring, pinky fingers and thumb up on left hand; only thumb up on right hand.
- 77: `11oo1` `1oo11` ring finger, pinky finger, and thumb up on both right and left hands.
Constraints — Why Less is More in Programming Languages
Tags: webdev, productivity, programming
Published: 2020-04-30 19:20:26

Constraints are an interesting concept. Much has been written and spoken about them.

On their surface, constraints are misleading. Saying that more freedom is bad is not very common. Normally we want more features, more flexibility, and more freedom. But constraints, if used wisely, can actually increase productivity and efficiency and reduce cost.

Constraints are used in many capacities, such as reducing analysis paralysis, improving efficiency, and inciting innovation. As a productivity technique, people often use artificial constraints like timeboxing and artificial deadlines.

In art, we use constraints to inspire creativity. Think of the intense constraints of Haiku.

In Star Wars (it always pleases me when I can throw a Star Wars reference into my articles), Luke didn’t begin to feel the force until Obi-Wan made him fight blind.

[!image](https://miro.medium.com/max/1276/0*3m4t6lF5ynJdcWwG?)

In programming, constraints seem to be all the rage. Functional Programming, immutability, TDD, these are all examples of artificial constraints.

In programming languages, constraints are an interesting concept.

Years ago, the language BASIC was somewhat popular. At that time Edgar Dijkstra, one of the pioneers of our industry, wrote the seminal paper “[Go To Statement Considered Harmful.](https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf)” Sadly, the most likely reason you know about this paper is the many times this phrase has been copied for less accurate purposes. It’s a short paper and worth a read through.

Another interesting example is Rust. Rust doesn’t have exceptions. Error handling is done very differently in Rust from other languages. Again the use of a constraint has given Rust what most people consider to be a significant advantage.

Recently Microsoft announced [Bosque](https://www.microsoft.com/en-us/research/project/bosque-programming-language/). Bosque has no looping mechanism. You can use functions like map to operate on all elements in a collection, but you can’t loop over them the way other languages do. Again, the intention is to improve by taking away.

JavaScript is an incredibly flexible language. Many things can be done in so many ways. But taking advantage of all that freedom often leads to disaster. Just look at [smooshgate](https://developers.google.com/web/updates/2018/03/smooshgate), which is why we have Array.flat() instead of Array.flatten().

So as you design your applications, and create conventions for yourself and other members of your team to follow, be sure to consider the value of constraints on all aspects of how you build your code.

Happy Coding!

Enjoy this discussion? Sign up for our newsletter [here](https://thinkster.io/?previewmodal=signup
https://thinkster.io).

Visit Us: [thinkster.io](https://thinkster.io?utm_source=devto&utm_medium=blog&utm_term=constraintsinprogramminglanguages&utm_content=&utm_campaign=blog) | Facebook: @gothinkster | Twitter: @GoThinkster
Question: Is this a terrible idea?
Tags: typescript, javascript, question
Published: 2020-04-30 03:32:10

---
title: Question: Is this a terrible idea?
published: true
description: I feel like this might be a terrible idea
tags: typescript,javascript,question
---

I have a bunch of utility functions in typescript for doing various things. I find that I often want to check if an array has any elements in it, but I am not sure if that array is undefined or null. I wind up with blocks similar to this in my code:

```
if (!someArray || someArray.length == 0) {
   doNothing();
} else {
   doSomething();
}
```

My first instinct was to write this method. 

```
export function any<T>(arr: T[]): boolean {
    if (!arr) return false;
    return arr.length > 0;
}
```

The original code block becomes this, which I find more readable: 

```
if (any(someArray)) {
   doSomething();
} else {
   doNothing();
}
```

I chose 'any' because I spend a lot of time in c# land and it roughly matches the LINQ method enumerable.Any(). However, using a reserved word for a function name seemed like a bad idea. Is it a bad idea?
Even if the transpiler allows it, maybe it is even less readable since any is the "I don't know what type this is" type.

In this instance, I chose to rename the function to atLeastOne which is a little more descriptive and doesn't clash with a reserved word, but I am still wondering if it was a bad idea.
Como editar qualquer página da Web ativando o Modo Design
Tags: design, javascript, webdev, devops
Published: 2020-04-30 18:57:29

Você pode editar qualquer site diretamente no seu navegador.
Se o modo de design estiver ativado, o usuário poderá editar todo o conteúdo do documento, como em um editor de texto, só que interno.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2vjbidu1tj8m6y6jp1c5.png)

A propriedade designMode não é suportada por elementos HTML, apenas o estado editável de todo o documento pode ser modificado com ele.