teleren/devto huggingface dataset:
Refactoring a Python Bot [Live Coding Recap]
Tags: python, beginners, livecoding, twitch
Published: 2019-11-03 01:24:20

## Streamed: 10/29 on Twitch

**Topic(s):** We hung out & refactored DeepThonk (the python bot's) code!
**Language:** [Python](http://bit.ly/nb9kPython), JSON
**Tech & libs used:** [VSCode](http://bit.ly/vscodenb9k), [TwitchIO](https://github.com/TwitchIO/TwitchIO)

> 👇 You can find the notes and code from stream down below! :D

⭐ **Star** ⇒ [Project Repository](http://bit.ly/DeepThonkRepo)
💜 **Follow** ⇒ on [Twitch](http://bit.ly/nb9kTwitch) and [GitHub](https://github.com/NinjaBunny9000)
🔴 **Watch** ⇒ [Twitch VOD](https://www.twitch.tv/videos/501498825) (replay)

## During the stream we...
✔ moved !project from FAQ's into it's own command
✔ made !project settable from chat
✔ moved all other commands to commands.py
✔ cleaned up commands & commented uncommented funcs
✔ created a `command` module and moved all commands in there
✔ created a command to enable/disable shoutouts
✔ created a `!raider` command to thank (and shoutout) raiders!

## Here's some of the code we wrote...

Shoutouts can be a little too much sometimes when we're actively developing the bot, so we created a chat function to turn them on or off on the fly.

```python
# in commands.cmds
@bot.command(name='shoutouts')
async def shoutouts(ctx):
    'toggles shoutouts on or off'
    if data.get_setting('shoutouts'):
        data.set_setting('shoutouts', False)
        await ctx.send('Shoutouts are off now.')
    else:
        data.set_setting('shoutouts', True)
        await ctx.send('Shoutouts are back on!')
```

And, at the recommendation of chat, we created a command to shout out (and thank) raiders.

```python
# in commands.cmds
@bot.command(name='raider')
async def raider(ctx):
    'shouts & thanks raiders'
    token = ctx.content.split(' ', 1)
    if token[1][0] == '@':  # strip @'s if they passed in user name arg with one
        raider = token[1][1:]
    else:
        raider = token[1]
    msg = f"ninjab1Bigups to @{raider} for the sick raid! Check them out at https://twitch.tv/{raider}"
    await ctx.send(msg)
```
If you care about user privacy, do NOT use Facebook JS SDK
Tags: privacy, facebook, openid, oauth
Published: 2019-11-03 08:19:19

Social Login buttons like the ubiquitous *Login with Facebook/Google/Twitter/...* button is convenient for users as they don't have to go through a lengthy registration process and create yet another username/password. And without a proper password manager (which probably 99% users don't use), they tend to reuse the same password which is bad in terms of security!

However behind the scene, some SDKs (I'm looking at you Facebook!) inject an iframe in your website to display the **Continue as {MyName}** or **Login with Facebook** button. Loading this iframe allows Facebook to know that this specific user is currently on your website. Facebook therefore knows about user browsing behaviour without user's explicit consent. If more and more websites adopt Facebook SDK then Facebook would potentially have user's **full browsing history**! And as in "With great power comes great responsibility", it's part of our job as developers to protect users privacy even when they don't ask for.

> Loading this iframe allows Facebook to know that this specific user is currently on your website

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/g2392w6ky7mex284apn8.png)

The iframe is actually injected in a second script loaded by the `https://connect.facebook.net/en_US/sdk.js`:


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/far46mhbj36p51lbknx6.png)

So what should we do to provide this *Login with Facebook* button to our users? The good news is this is actually easy as Facebook implements OAuth2/OpenID standard so you can use any OAuth2/OpenID library to add the Facebook login button. You can also add other login providers like Google, Github, Apple ... at the same time as those are also OAuth2/OpenID-compliant. 

Here are some ressources to implement OAuth2/OpenID in your app for different languages/frameworks:

- JS: [hello.js](https://adodson.com/hello.js/), [jso](https://github.com/andreassolberg/jso), [oidc-client-js](https://github.com/IdentityModel/oidc-client-js). oidc-client-js is used to create some OAuth2/OpenID libraries for frameworks like React, VueJS, Angular, Aurelia as listed on https://github.com/IdentityModel/oidc-client-js/wiki

- Python: [Requests-OAuthlib](https://github.com/requests/requests-oauthlib), [Authlib](https://github.com/lepture/authlib), [Python Social Auth](https://python-social-auth-docs.readthedocs.io/en/latest/)

- NodeJS: [PassportJS](http://passportjs.org/), [openid-client](https://github.com/panva/node-openid-client).

If you happen to use Flask (Python), I have written an article on dev.to on how to implement OAuth2/OpenID into a Flask application: https://dev.to/simplelogin/create-a-flask-application-with-sso-login-f9m

If you really need Facebook SDK, please ask user consent before loading the SDK or only load the SDK when user clicks on the `Login with Facebook` button.

Update 1: turns out that Google also uses this practice, more info can be found on https://news.ycombinator.com/item?id=21429482
A Case Against Open Floor Offices
Tags: office, workculture, teamwork, softwaredevelopment
Published: 2019-11-03 08:12:39

---
title: A Case Against Open Floor Offices
published: true
description: Do Open Floor offices truly foster Team Work. I argue.
tags: office, work-culture, team-work, software-development
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sqxjpyv8zp03jnf2d85l.jpg
---

Alright, let me begin with my own experience with working on so-called team-building open floor offices that are the rage with IT companies these days. Honestly, the experience has been one on the downside and I personally prefer a place to work that is quiet and fosters imagination, creativity and the so-called Deep Work. 

I, like many of you, work in the area of Software Development and quite frankly, it requires bouts of concentration and focus to get work done efficiently. I have worked in many different office spaces before and sadly most of the places had this open office floor trend. In general, I prefer to have no grudges with working in an open environment where one is easily reachable and communication flows freely, but especially for this one particular area which I discuss in this post, I strongly believe that the culture that open offices promote is not very conducive to effective work.

Effective Software Development, for once requires considerable amounts of focus and attention to detail to get the job done. WIth constant chatters, murmurs, and activity going in and around the office floor, the mind constantly is forced to get its attention diverted from the task at hand.

Our attention span is quite limited and the way we human beings are manufactured, we pretty much suck at multi-tasking. In order for us to concentrate fully on a given task, hands-on coding, for instance, we require constant undiverted attention.

I believe what we as programmers can achieve with constant focus and concentration in a given time far outweighs when the attention is diverted often. The mind consumes a lot of energy when it shifts attention from one task to another. So if we constantly try to focus on our work and there are distractions nearby, it fails to concentrate and is forced to multitask which in turn is very taxing in terms of energy consumption.

I strongly believe that open-floor offices with all their happenings, chit-chats and on-demand availability work culture is not at all helping in fostering growth and productivity.

No wonder we accomplish far more in the days we work from home or from a peaceful place like a library. The topic is debatable but I have my priorities sorted.

What do you think? Please share your thoughts in the comments below.

Have a productive week ahead!
Introduction to Event Streaming with Kafka and Kafdrop
Tags: kafka, eventstreaming, microservices, eventsourcing
Published: 2019-11-03 08:12:10

Event sourcing, eventual consistency, microservices, CQRS... These are quickly becoming household names in mainstream application development. But do you know what makes them tick? What are the basic building blocks required to assemble complex, business-centric applications from fine-grained services without turning the lot into a big ball of mud?

This article examines a fundamental building block — **event streaming**. Leading the charge will be [Apache Kafka](https://kafka.apache.org) — the _de facto_ standard in event streaming platforms, which we'll observe through [Kafdrop](https://github.com/obsidiandynamics/kafdrop) — a feature-packed web UI.

# A Brief Intro
Event streaming platforms reside in the broader class of Message-oriented Middleware (MoM) and are similar to traditional message queues and topics, but offer stronger temporal guarantees and typically order-of-magnitude performance gains due to **log-structured immutability**. In simple terms, write operations are mostly limited to sequential appends, which make them fast. _Really fast._ 

[Read the rest of the article on Medium](https://medium.com/swlh/introduction-to-event-streaming-with-kafka-and-kafdrop-22afdb4b380a)
Learning Python
Tags: help
Published: 2019-11-03 05:25:46

I'll make this short and simple
-------------------------------
I already have experience using various programming languages such as C++, Java, JavaScript and made a few small projects. Played around with Node.js to get a feel for Full Stack Development.

My problem is that, I don't learn anything deeply enough. I always tend learn something out of curiosity, make tiny projects, leave it and find something new again.

Currently, I have decided to learn Python and I don't want to do the same thing again.

So, here are my questions:
1. Where should I learn Python? (document/book/tutorial)
2. What approach should I use to learn it well to make use of it?
3. In case you think I should make projects, please give some good project ideas as I have hard time finding something good and also isn't too complicated.
4. How do I stay motivated?

Thank you. :)
A rap song about writing tests
Tags: showdev, culture, testing, discuss
Published: 2019-11-03 01:25:16

---
title: A rap song about writing tests
published: true
description: https://www.youtube.com/watch?v=WkODp99eQ4M
tags: #showdev, #culture, #testing, #discuss
---

Song url: https://www.youtube.com/watch?v=WkODp99eQ4M

Quick background on the project: I'm a full time programmer and I love making rap music. I see a lot of humor in the profession/industry, and thought it would be fun to combine the two.

I'm always open to feedback and collaboration (currently in CO, would love to work with a videographer to make a music video)!
Shout out to an awesome DEV.to member and his sick flows
Tags: discuss, showdev, webdev
Published: 2019-11-03 04:54:27

---
title: Shout out to an awesome DEV.to member and his sick flows
published: true
description: Shout out to a awesome DEV.to member and his sick flows
tags: discuss, showdev, webdev
---

This user writes and sings awesome rap songs about tech. They are hilarious and also have a great beat and flow to them. 

So good I had to give a shoutout to him! 

[stdoutrap](https://dev.to/stdoutrap)
[plugin] COOPACL - Joomla! ACL enhancement user fine grained access level
Tags: joomla, plugin, acl, webdev
Published: 2019-11-03 04:24:28

---
title: [plugin] COOPACL - Joomla! ACL enhancement user fine grained access level
published: true
date: 2019-11-03 03:35:25 UTC
cover_image: https://thepracticaldev.s3.amazonaws.com/i/1z49sv64up1lnwmge06s.jpg
tags: joomla,plugin,acl,webdev
canonical_url: 
---

Hello Super Joomlers!

Breaking news! I decided to share a plugin used internally in my company to the Joomla! community for free on Github.

It allows you to define access level not just for groups as Joomla! actually do, but also for individual users and even both.

Its called COOPACL because it cooperates with Joomla! core ACL. It's a system plugin. You just install one plugin and voilà!

You will automatically have new functionnality when you go in your Joomla! backend in the access level menu.

Now, when you create a new access level you can choose, a group (eg: Registered), a user (eg: Example User) or both.

In the access level list view you will see the selection accordingly.

Thanks for your time.

[Get the code of plg\_system\_coopacl on Github](https://github.com/alexandreelise/plg_system_coopacl "Get the code of plg\_system\_coopacl on Github")
[plugin] COOPACL - Amélioration des ACL de Joomla! Niveau d'accès précis à l'utilisateur près
Tags: webdev, acl, joomla
Published: 2020-03-17 15:34:55

---
title: [plugin] COOPACL - Amélioration des ACL de Joomla! Niveau d'accès précis à l'utilisateur près
published: true
date: 2019-11-03 03:35:25 UTC
tags: webdev,acl,joomla
canonical_url: 
---

## Salut les joomlers de l'extrême!

 

Bonne nouvelle! J'ai décidé de donner à la communauté en libre accès sur Github un plugin que j'ai créé  et que j'utiise en interne dans mon entreprise.

Ce plugin vous permet de définir des niveaux d'accès non pas seulement pour les groupes, comme le fait actuellement Joomla!, mais aussi pour chaque utilisateur et peu même faire les deux (groupes et utilisateurs).

Ca s'appelle COOPACL parce que cela "coopère" avec les ACL du coeur de Joomla!. C'est un plugin système. Vous installez un seul plugin et voilà!

Vous aurez automatiquement la nouvelle fonctionnalité quand vous irez dans la partie admin de votre site Joomla! dans le menu "Niveaux d'accès".

Désormais, vous pourrez créer un nouveau niveau d'accès puis choisir un groupe (ex: Registered), un utilisateur (ex: Utilsateur 1) ou les deux.

Dans la liste des niveaux d'accès vous verrez ce que vous avez choisi.

Merci pour votre temps et votre patience.

[Voir le code de plg\_system\_coopacl sur Github](https://github.com/alexandreelise/plg_system_coopacl "Voir le code de plg\_system\_coopacl sur Github")
CSS Button Transition (Animation)
Tags: css, beginners, design, html
Published: 2019-11-03 02:08:35

Transitions: The transition CSS property specifies the name of the CSS property the transition effect is for. In this case we will be transitioning the transform property. You can transition most properties in CSS, like background, color, etc.

A transition needs a beginning and an end state. Thus, transitioning buttons is a great way to use them. Let's do that below.

The beginning state is div styles for the button, which is 200px wide, 75px in height, along with other CSS properties. Our end state will be a hover, or, when a user hovers over the button. 

On hover the button changes its background color and scales down. To scale down we apply a transform property and set its value to scale which is a function of the transform property. Transformation functions can rotate, resize, distort and move an element in 2d or 3d space. In this case we are choosing the scale function to resize the button.


``` css 

div {
width: 200px;
height: 75px;
border-radius: 50px;
background: #0000FF;
transition: transform .6s .25s ease-out; /* apply transition property to the object (div element) that will be transitioning and set the value to the property to transition */
} 


div:hover {
background: #0F0F94;
transform:scale(.9); /* apply transition effect */
} 

```

See CodePen here: shorturl.at/gx038
Who is your hosting provider?
Tags: discuss, linux
Published: 2019-11-03 01:52:42

Hello everybody, 
I have my main host that will close. That's why on the one hand I would like to know your **web hosts** and **VPS** that you have chosen for your personal projects.

* The name of the hosting and [its link](#)
* The price 
* Its features
* Pros and cons
REGEXP & DATABASES
Tags: ruby, beginners, todayilearned
Published: 2019-11-03 01:52:05



Recently I am doing my 30-days-code challenge on HackerRank and came across this topic again. I wanted to share here what I have learned about so far.

I have a love-hate relationship with Regexp aka Regular expressions. My friends around me are either hate it or love it. My first thought before this was - wow, this is nice, no crazy functions, loops....but wait, the syntax, symbols are like crazy?


![Alt Text](https://media.giphy.com/media/l0IypeKl9NJhPFMrK/giphy.gif)

## What the hell is Regexp?

This is a compact syntax means of describing a set of strings using a subset of common characteristics. For example, the common characteristics of *aaa*, *aba*, and *aca* are that they all start and end with the letter *a*.

Regular expressions add a layer of abstraction to strings that make it easier to search and manipulate text. While they can seem very confusing at first, however, the syntax for regular expressions is pretty standard across different programming languages.


## Why use it?

For **Data validation** and **Data extraction**. Just like taking the information you wanted from a HUGE excel file. Regex reduces the pain to search a piece of data one by one from the databases. Pretty cool, huh

![alt text](https://media2.giphy.com/media/3oKIPlLZEbEbacWqOc/200.webp?cid=790b7611aa60f4717e016d5a63a5833481346c8ef93ef487&rid=200.webp)

## The Regexp class

Regular Expressions are class citizens in Ruby. They have their own class, which comes with its own built-in methods like `match`, `scan`, and `gsub`.

## Regexp buddy

Here are some tools for using Regexp.
- [Rubular](https://rubular.com/)
- [RegExr Community](https://regexr.com/)
- [Regex101](https://regex101.com/)
- [Debuggex](https://www.debuggex.com/)

## Further Read

This is the [Documentation](https://ruby-doc.org/core-2.6.5/Regexp.html) and [guide](https://www.tutorialspoint.com/ruby/ruby_regular_expressions.htm) for regex in Ruby.

![alt text](http://giphygifs.s3.amazonaws.com/media/rdma0nDFZMR32/giphy.gif)

**Happy Regexing!** 🚀
More experiments with form animations ✅
Tags: showdev, css, javascript, webdev
Published: 2019-11-03 00:45:47

[A sort of follow-up to this post](https://dev.to/rose/css-variables-input-type-color-and-form-animations-4g1n) .... a few more form animations.

Not totally happy with the execution in some cases (eg: Why does Firefox require that I use a setTimeout for the transition in example 1 to work correctly? I thought just using something like requestAnimationFrame would suffice but it does not.). , nor with my artistic direction (I feel like someone else could really figure out how to make these "pop" in a super-cool way.)

But they're kind of fun. Enough to show off I guess 🙂 

For the first: Using transitions on `transform` and utilizing `getBoundingClientRect` to calculate where the dot needs to move to. Works well for this simple case but if you wanted to use it IRL with a bunch of relatively positioned elements etc it would probably need some better positioning logic.

{% codepen https://codepen.io/roseyrobertson/pen/ExxomQx default-tab=result %}


For the second: a SVG with a bunch of little circles that scales in size and fades out, so it looks like a little burst of dots. This one was inspired by something on dribbble (https://dribbble.com/shots/6440021-Card-Theme-Switch) that is way cooler than my attempt to "do something similar but not totally copy"

{% codepen https://codepen.io/roseyrobertson/pen/WNNdgLj default-tab=result %}
'spyOn' is not defined.eslint(no-undef)
Tags: jest, jasmine, typescript, eslint
Published: 2019-11-03 00:15:42

When testing Typescript files, ESLint might complain about some Jest/Jasmine functions (e.g. `describe`, `test`, `it`, `onSpy`, etc.):

```
'describe' is not defined.eslint(no-undef)
```

That happens even after installing the `@types/jest` package.

[ESLint](https://eslint.org/docs/user-guide/configuring) needs you to specify which environments your script will run:

```yml
// .eslintrc.yml
env:
  - jasmine: true
  - jest: true
```

Now, Jasmine and Jest types will be set as global variables and your linting will work again. :)

---

[Follow me on Twitter](https://twitter.com/ceolinwill)
functions/lib/index.js does not exist, can't deploy Cloud Functions
Tags: firebase, cloudfunctions, typescript
Published: 2019-11-03 00:02:46

Sometimes when you're deploying a monorepo to [Cloud Functions for Firebase](https://firebase.google.com/docs/functions), you'll get the following error:

```
Error: There was an error reading functions/package.json:
 functions/lib/index.js does not exist, can't deploy Cloud Functions
```

In some cases, that's happening because you're importing external types and Typescript is adding them to the compiled `lib` folder. Therefore, Firebase isn't able to find your functions because the default path is wrong.

Because Firebase uses the `main` field from your `functions/package.json` file, you just have to update it with the correct compiled path:

```json
{
  "main": "lib/functions/src/index.js"
}
```

---

[Follow me on Twitter](https://twitter.com/ceolinwill)
Monthly review: October
Tags: rust, sponsorships
Published: 2020-01-06 20:26:32

---
title: Monthly review: October
published: true
date: 2019-11-03 00:00:00 UTC
tags: rust, sponsorships
canonical_url: 
---

## New Sponsors

Thanks to [@oli-obk](https://github.com/oli-obk) and [@yaahc](https://github.com/yaahc), my very first sponsors :tada:

## What I’ve worked on

My main goal for November was getting all the sponsoring figured out and set up.The first half of the month was more or less about figuring out all this stuff andmaking sure sponsoring is fine with [my employer](https://esanum.com). This included:

- The [sponsoring blog post](https://phansch.net/2019/10/21/sponsoring/)
- The [thanks page](https://phansch.net/thanks/)
- The GitHub [sponsorship profile](https://github.com/sponsors/phansch)
- The Stripe account setup
- A [paypal.me profile](https://www.paypal.me/philhansch)
- Lot’s of research into crowdfunding

The second half of the month I had more time to work on Rust things:

- Continuing with annotate-snippet-rs
- [Fixing a Clippy bug](https://github.com/rust-lang/rust-clippy/pull/4721)
- [A small refactoring in rustc](https://github.com/rust-lang/rust/pull/65428)

Unfortunately I got sick with a strong cold at the end of the month and I’mstill recovering from it as I’m finishing up this post, so I’m going to keepthis months review a bit shorter and focus on getting healthy again.

This November I hope to finish up my two existing Clippy PRs ([1](https://github.com/rust-lang/rust-clippy/pull/4766),[2](https://github.com/rust-lang/rust-clippy/pull/4588)) but I will also be on holiday for two weeks. The remaining time Iwant to try and see how I can help out with the effort over at[annotate-snippet-rs](https://github.com/rust-lang/annotate-snippets-rs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc).
How to use TDD to build a REST API in Laravel
Tags: laravel, tdd, codeception, php
Published: 2019-11-02 22:45:47

YouTube playlist link:
https://www.youtube.com/playlist?list=PLrIm-p2rpV0F-rl4NPjNslEmW-D83AHOr

So I have been working on a long series aimed at teaching you how to follow Test Driven Development. 

I chose to create a series using Laravel and Codeception for you to learn how to implement TDD. The series has 25 videos so far!

I really hope you guys like it, it has already taken over a month of my time.