teleren/devto huggingface dataset:
Just a couple of tiny recipes for pipenv
Tags: python, pipenv
Published: 2020-10-12 05:36:58

---
title: Just a couple of tiny recipes for pipenv
published: true
date: 2020-03-08 00:00:00 UTC
tags: [python, pipenv]
canonical_url: https://blog.ukena.de/posts/getting-started-with-pipenv/
---
## How to migrate an existing project from requirements.txt to a pipenv Pipfile

This will create a new virtual environment for your current folder and install all requirements from requirements.txt. Put another way: This will "convert" your `requirements.txt` into a `Pipfile`:

**Run this from the project folder containing the `requirements.txt` file.**

```(bash)
$ touch Pipfile
$ pipenv install -r requirements.txt
```

Output:

```bash
Creating a Pipfile for this project…
Requirements file provided! Importing into Pipfile…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✔ Success! 
Updated Pipfile.lock (037725)!
Installing dependencies from Pipfile.lock (037725)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 42/42 — 00:00:07
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
```

Next step: verify that the generated `Pipfile` contains all your requirements. 

Feel free to delete the requirements.txt. You can always create a new one by calling `pipenv run pip freeze > requirements.txt`.

### Caveats

- If your `requirements.txt` contains `-e .` this will be converted to an absolute path in the generated `Pipefile`. You probably do not want this, because it will break on other machines with different paths. *To fix:* Open your Pipfile and change the absolute path from  `file = "file:///Users/..."` simply to `file = "."`. ([Source](https://github.com/pypa/pipfile/issues/50))

### Note

`touch`ing the Pipfile is important, in case you already have a Pipfile in a parent-folder of your current path. *This has tripped me up so many times.*

## How to create a virtual environment for a specific version of Python

Obviously, the specified version should be installed on your system first. Pipenv will not handle that for you.

To use any python 3 version:

```(bash)
$ touch Pipfile
$ pipenv --python 3
```

To use python version 3.8.1:

```(bash)
$ touch Pipfile
$ pipenv --python 3.8.1
```
MySQL
Tags: ubuntu, reminders, mysql
Published: 2020-05-10 09:56:41

---
title: MySQL
published: true
date: 2020-03-08 00:00:00 UTC
tags: ubuntu, reminders, mysql
canonical_url: http://jamessessford.com/blog/mysql
---

I always forget how to do some MySQL operations, especially the more modern ways to add users.I'm listing them here in hopes of either cementing the information because I've written it downor finding my own blog post when I have to search again :)

Depening on what environment you're working in, you could be accessing MySQL in a multitude of different ways.I'm currently using DBeaver & MyCLI on my Ubuntu laptop & HeidiSQL at work.

## Databases

```
CREATE DATABASE mydatabase;
```

## Users

```
CREATE USER 'mydatabaseuser'@'%' IDENTIFIED WITH mysql_native_password BY 'mydatabasepassword';
```

## Permissions

```
GRANT ALL ON mydatabase.* to 'mydatabaseuser'@'%';
FLUSH PRIVILEGES;
```

## Access

```
mycli -u mydatabaseuser -p mydatabase
```

I'll probably update this post with more MySQL things I remember that I forget as time goes on!
Subvent.js: Managing event subscriptions in DOM
Tags: dom, event, library, javascript
Published: 2020-03-07 22:28:36

[**Subvent**](https://github.com/filiBit/subvent) is a small javascript library for defining and managing event subscriptions in an intuitive and practical way. The human friendly way.

If You're wondering what's wrong with the way DOM handles event listeners currently, I wrote about it in [another post](https://dev.to/filibit/the-problem-with-dom-s-event-listeners-3m5m), now we'll focus on the solution. Let's get to the code:

Let's include the library first in the head of our HTML document:
`<script src="https://unpkg.com/subvent@1.1.0/dist/iife/subvent.js"></script>`

Getting the DOM Nodes (elements) we're going to use
throughout this article:

```js
const el1 = document.getElementById('element-1');
const el2 = // ...
const el3 = // ...
const el4 = // ...
```

**Define the event subscription:**
```js
const evtSub1 = new Subvent(el1, 'click', () => {...});
```
- creates an instance of Subvent
- the instance represents an event subscription

The shorthand **`on`** function is also available:
```js
const evtSub2 = on(el2, 'click', () => {...});
```
If preferred, use an object to pass parameters:
```js
const evtSub3 = on({node: el3, name: 'click', handler: () => {...}});
```

## Manage the subscription

**Unmount it:**
```js
evtSub1.unmount();
evtSub1.isMounted; // false
```

**Mount it:**
```js
evtSub1.mount();
evtSub1.isMounted; // true
```

**Update it:**
```js
evtSub2.update({name: 'dblclick'});
```
- takes care of mounting and unmounting for us
- only changes the specifed arguments, retaining previous parameters.

**Duplicate it:**
```js
const evtSub4 = evtSub3.duplicate({node: el4})
```
- uses Subvent's instance as a template for creating a new instance
- instance being duplicated provides fallback values for undefined parameters


## About the library

The library works by gathering all the related variables of the event listener into a subscription object, an instance of Subvent class. This instance holds all the relevant properties: (`node`, `name`, `handler`, `options`, `thisArg` and `isMounted`), and all the methods (`mount`, `unmount`, `update` and `duplicate`). Very usefull stuff.

Subvent also error-checks all the parameters by value and type, and provides warnings.

To start using Subvent head on over to it's repository here:

{% github filibit/subvent %}

## Feedback is welcome

If You have an opinion, or and idea on how to improve it, feel free to share it with us, or contact me directly.

Thank You
empty? any? present? blank? wat?
Tags: rails, activerecord
Published: 2020-03-08 12:55:16

---
title: empty? any? present? blank? wat?
published: true
date: 2020-03-08 00:00:00 UTC
tags: Ruby on Rails,ActiveRecord
canonical_url: https://bridge-u.dev/empty-any-present-blank-wat
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y682n7xvrfmbkgkmelnl.jpg
---

I’ve recently wrote an article for my [company’s blog](https://bridge-u.dev) — our first one! It’s about Ruby on Rails’s method to check if a collection is empty or not. Some of these methods come from Ruby, some exclusively from Rails, and we dive a bit on the subtle differences between them. You can read it in its full length [here](https://bridge-u.dev/empty-any-present-blank-wat). 💎 Enjoy!

Photo by [Paolo Nicolello](https://unsplash.com/@paul_nic?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/confused?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText).
NOTE: simply typed lambda calculus
Tags: plt
Published: 2020-03-10 08:35:16

---
title: NOTE: simply typed lambda calculus
published: true
date: 2020-03-08 00:00:00 UTC
tags: plt
canonical_url: https://dannypsnl.github.io/docs/cs/note-stlc/
---

Last time I introduce [lambda calculus](https://dannypsnl.github.io/docs/cs/note-what-is-lambda-calculus/).Lambda calculus is powerful enough for computation. But it’s not good enough for people, compare with below **Church Numerals**

{% katex %}
add := \lambda m. \lambda n. \lambda s. \lambda z. m\;s\;(n\;s\;z)
{% endkatex %}

people prefer just `+` more.

But once we introduce such fundamental operations into the system, validation would be a thing. This is the main reason to have a λ→ system(a.k.a. simply typed lambda calculus). It gets name λ→ is because it introduces one new type: Arrow type, represent as T1→T2 for any abstraction λx.M where x has a type is T1 and M has a type is T2. Therefore we can limit the input to a specified type, without considering how to add two `Car` together!

To represent this, syntax needs a little change:

```bnf
term ::= terms
  x variable
  λx: T.term abstraction
  term term application
```

Abstraction now can describe it’s parameter type. Then we have typing rules:

{% katex %}
\frac{
  x:T \in \Gamma
  }{
  \Gamma \vdash x:T
  } \;\;\;\; T-Variable
{% endkatex %}
{% katex %}
\frac{
  \Gamma, x:T_1 \vdash t_2: T_2
  }{
  \Gamma \vdash \lambda x:T_1.t_2 : T_1 \to T_2
  } \;\;\;\; T-Abstraction
{% endkatex %}
{% katex %}
\frac{
  \Gamma, t_1:T_1 \to T_2 \; \Gamma \vdash t_2: T_1
  }{
  \Gamma \vdash t_1 \; t_2 : T_2
  } \;\;\;\; T-Application
{% endkatex %}

Here is the explanation:

- T-Variable: with the premise, term x binds to type T in context Γ is truth. We can make a conclusion, in context Γ, we can judge the type of x is T.
- T-Abstraction: with the premise, with context Γ and term x binds to type T1 we can judge term t2 has type T2. We can make a conclusion, in context Γ, we can judge the type of λx:T1.t2 is T1→T2.
- T-Application: with the premise, with context Γ and term t1 binds to type T1→T2 and with context Γ we can judge term t2 has type T1. We can make a conclusion, in context Γ, we can judge the type of t1t2 is T2.
Good readings this week – Learn faster, work harder, repeat
Tags: goodreadings
Published: 2020-06-12 09:35:08

---
title: Good readings this week – Learn faster, work harder, repeat
published: true
date: 2020-03-07 23:26:53 UTC
tags: goodreadings
canonical_url: https://boobo94.xyz/good-readings/good-readings-this-week-learn-faster-work-harder-repeat/?utm_source=rss&utm_medium=rss&utm_campaign=good-readings-this-week-learn-faster-work-harder-repeat
---

[Good readings this week](https://boobo94.xyz/good-readings) is a series of articles that aim to share my readings every week. This includes maybe articles, books or video materials.

- [https://www.entrepreneur.com/article/237455](https://www.entrepreneur.com/article/237455)
- [https://medium.com/swlh/12-business-lessons-from-seth-godin-acb0e71e1adc](https://medium.com/swlh/12-business-lessons-from-seth-godin-acb0e71e1adc)
- [https://www.nginx.com/blog/microservices-at-netflix-architectural-best-practices](https://www.nginx.com/blog/microservices-at-netflix-architectural-best-practices)
- [https://dev.to/leirasanchez/like-console-log-but-better-nhm](https://dev.to/godspowercuche/like-console-log-but-better-1cmo-temp-slug-2281378)
- [https://dev.to/wilsonj806/how-i-upgraded-my-portfolio-19f4](https://dev.to/wilsonj806/how-i-upgraded-my-portfolio-19f4)
- [https://medium.com/@timdenning/you-can-never-truly-be-a-business-owner-as-an-employee-5b2e17c9482c](https://medium.com/@timdenning/you-can-never-truly-be-a-business-owner-as-an-employee-5b2e17c9482c)

You can check the [full series about Good Readings](https://boobo94.xyz/good-readings).

The post [Good readings this week – Learn faster, work harder, repeat](https://boobo94.xyz/good-readings/good-readings-this-week-learn-faster-work-harder-repeat/) appeared first on [boobo94](https://boobo94.xyz).
📚 libgen downloader, a command line tool to search and download ebooks from libgen
Tags: typescript, node, npm, tool
Published: 2020-03-07 22:34:52

Hello everyone! 👋

These days, i'm trying to get into `nodejs` and `typescript` ecosystem and trying to make usefull apps to learn how can i use them in real life and how can improve my productivity with these tools. So i thought that developing a command line app is an appropriate playground to adapt myself into ecosystem and started to looking for a project idea.

![](https://raw.githubusercontent.com/obsfx/libgen-cli-downloader/master/demo.gif)

While i was looking for a idea, i realized that i often use libgen. As a student, libgen is my best friend to get the well-qualified technical resources so i wanted to make an app that simplifies the libgen experience and works on my terminal. So i have developed [libgen-downloader](https://obsfx.github.io/libgen-downloader).

I care feedbacks, if you interested in this project and want to see the source code or want to install that on your machine you can check the github repo, github page and npm page;

[github.com/obsfx/libgen-cli-downloader](https://github.com/obsfx/libgen-cli-downloader)

[obsfx.github.io/libgen-downloader](https://obsfx.github.io/libgen-downloader/)

[npmjs.com/package/libgen-downloader](https://www.npmjs.com/package/libgen-downloader)
Facepalm moment of the day
Tags: debugging
Published: 2020-03-07 22:32:41

---
title: Facepalm moment of the day
published: true
description: Debugging nightmares
tags: debugging
---

I'm developing an app in Flutter and Dart and I come across an issue where an event being added to my BLoC. (A stream-based state management solution for the uninitiated)

The state class is made up of a combination of a few different streams. When one releases an event, the state is updated with the latest updated value using a `copyWith()` function. This is all going fine and well until I push a null value into one of the streams and the state doesn't change. I know it was pushed successfully, but the old state is still reflected. Hopefully this will help some of you.

If your copyWith functions look like this:
```dart
State copyWith({int param1, String param2}){
  return State(
            param1: param1 ?? this.param1, 
            param2: param2 ?? this.param2
         ); 
```
then passing a null value will cause it to return the existing value even if you *intended* to set it to null. I doubt this is an issue in languages with an `Undefined` type, however, Dart does not have one.
Best way to make infrastructure by Terraform
Tags: devops, help, aws
Published: 2020-03-07 21:58:16

Hi,
I am new to terraform; I've been involving in a project and trying to make a CICD pipeline in order to work on data through multiple tiers and of course proper way to automate moving data between dev, staging and prod environment. I have some questions:

- What could be the best practice to set up terraform structure?
- Dividing modules into specific submodules is recommended?
- Is it good to use terraform for invoking Lambda or serverless is the better solution?

Well, I need your #help and Looking forward to hearing from you.

Thanks,
Facebook Security: Time for a checkup
Tags: security, facebook, privacy
Published: 2020-03-07 21:42:30

---
title: Facebook Security: Time for a checkup
published: true
date: 2020-03-07 21:37:27 UTC
tags: security, facebook, privacy
canonical_url: https://dougsillars.com/2020/03/07/facebook-security-time-for-a-checkup/
---

Online tracking is something we are all aware is happening.  And, like it or not - if a product is free - you are not the customer - you are the product being sold. Facebook has gotten in to a load of trouble with how it handles private information... yet it probably has more information … [Continue reading Facebook Security: Time for a checkup](https://dougsillars.com/2020/03/07/facebook-security-time-for-a-checkup/)
Using NgOnDestroy with Services in Angular
Tags: angular
Published: 2020-03-07 21:11:34

---
title: Using NgOnDestroy with Services in Angular
description: Learn how to use NgOnDestroy to clean up tasks in Angular Services.
tags: angular
published: true
canonical_url: https://coryrylan.com/blog/using-ngondestroy-with-services-in-angular
---

When an Angular component is destroyed, the `ngOnDestroy` life cycle method is called so we can clean up long-running tasks or unsubscribe from any RxJS Observables. Angular Services also have an `ngOnDestroy` method, just like Angular components. This lifecycle can be helpful when we create and destroy services that need to run some cleanup work when the component is destroyed.

Some services can have global event listeners or long-running tasks that, when no longer used, should be cleaned up. Angular Services typically are singletons by default but can be registered to create an instance per component.

```typescript
import { Component } from '@angular/core';
import { LogService } from './log.service';

@Component({
  selector: 'app-hello',
  template: `hello there`,
  providers: [LogService]
})
export class HelloComponent {
 constructor(private log: LogService) { }
}
```

In our example, we have a component that uses a `LogService`. The `LogService` is registered to the component providers rather than the root provider or an `NgModule`. This allows the service to be created and destroyed per instance of our component.

In our `LogService` we have simulated task that logs every second to the
console.

```typescript
import { Injectable } from '@angular/core';

@Injectable()
export class LogService {
  count = 0;

  constructor() {
    console.log('constructor: logging starting...');
    setInterval(() => {
      console.log(this.count++);
    }, 1000);
  }
}
```

When the service is created the `constructor` creates an interval that will log every one second.

```html
<button (click)="show = !show">toggle</button>

<app-hello *ngIf="show"></app-hello>
```

In our example, we toggle our component on the click of a button. When the component is shown the component is created as well as an instance of the `LogService`. When the component is removed, the component, as well as the `LogService`, is destroyed.

```typescript
import { Injectable } from '@angular/core';

@Injectable()
export class LogService {
  interval: any;
  count = 0;

  constructor() {
    console.log('constructor: logging starting...');
    this.interval = setInterval(() => {
      console.log(this.count++);
    }, 1000);
  }

  ngOnDestroy() {
    console.log('ngOnDestroy: cleaning up...');
    clearInterval(this.interval);
  }
}
```

When our service is destroyed, the `ngOnDestroy` method is called in our service. When the method is called, we can clean up any long-running tasks such as our running interval. Leveraging `ngOnDestroy` in services can be useful for ensuring we clean up tasks in our application. Check out the [full working demo](https://stackblitz.com/edit/angular-clvzww)
Docker Moodle images
Tags: moodle, docker, showdev
Published: 2020-03-07 21:05:06

As part of [Cypriot Free Software Community](https://ellak.org.cy) projects we developed some moodle docker images that offers a basic moodle installation in docker.

You can pull it from docker hub:

https://hub.docker.com/r/ellakcy/moodle


And have a look on source code as well:

https://github.com/ellakcy/docker-moodle

If any issue do not hesitate on setting an issue: https://github.com/ellakcy/docker-moodle/issues

Also presented in Fosscomm 2017 and in Fosscomm 2019 in Greece.
Using Web Components in Angular - Video Tutorial
Tags: webcomponents, angular
Published: 2020-03-07 20:51:16

---
title: Using Web Components in Angular - Video Tutorial
published: true
description: Learn in a video tutorial how to integrate and use Web Components in Angular.
tags: web-components, angular
canonical_url: https://coryrylan.com/blog/using-web-components-in-angular-video-tutorial
---

This is a sample video from my Video Course [Web Component Essentials](https://webcomponent.dev). In this video you will learn how to integrate and use Web Components in an Angular application. To get the written blog tutorial check out this post, ["Using Web Components in Angular"](https://coryrylan.com/blog/using-web-components-in-angular)

If what you watched was helpful checkout the full Video Course and EBook at [webcomponent.dev](https://webcomponent.dev)!
scss-system: responsiveness in one line
Tags: css, scss, sass, webdev
Published: 2020-03-07 19:28:17

Hi everybody,
I want to share with you a @mixin i created, 
inspired by TailwindCSS and styled-system.

[https://github.com/MarcoPal/scss-system](https://github.com/MarcoPal/scss-system)

Here's an example
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/sgl9m4k76msz6jbdedla.png)

And this is the output
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jxagik4o0lfjhbrn4p8y.png)

The only requirement is a $breakpoint list or map.

Check out the repo to [learn more](https://github.com/MarcoPal/scss-system)
Nevertheless, zuzanadostalova Coded
Tags: wecoded
Published: 2020-03-07 19:22:22

I am a biochemist (MSc. in Genomics and Proteomics at the Masaryk University in Brno, Czech Republic) who loves learning new things, languages in particular, so it felt natural to me to start learning how to code in Python. Up until then, I haven't had any experience with coding whatsoever. I have started to self-study Python at home while looking for an opportunity to put the gained knowledge to use. I was very lucky to have found a team in which I could learn Python while creating tutorials for fellow bioinformaticians. What I really appreciate about this work is that every workday is completely different, that it's possible to rectify your mistakes, and how helpful as well as supportive the coding community is. It’s quite challenging but I am really enthusiastic about this new chapter of my life.
I support people in dev
Tags: rant, misc, picture
Published: 2020-03-07 19:46:46

---
title: I support people in dev
published: true
date: 2020-03-07 19:19:03 UTC
tags: rant,misc,picture
canonical_url: https://siderite.dev/blog/i-support-people-in-dev/
---

![Stop the bullying, don't you see he's small and weird?](https://siderite.dev/Posts/files/ShamSupport_637192068742733054.jpg)I know I am shooting myself in the foot here, but, to paraphrase some people, staying quiet doesn't help anyone. I've come to love [Dev.to](https://dev.to/ "a community of software developers getting together to help one another out. The software industry relies on collaboration and networked learning."), a knowledge sharing platform aimed at software developers, because it actually promotes blogging and dissemination of information. It doesn't do enough against clickbait, but it's great so far. So, hungry for some new dev stuff, I opened up the website only to find it spammed with big colorful posters and posts supporting female devs. It was annoying, but it got me thinking.

  I like women in software! I too can honestly say I support them. I've always done so. I worked with them, mentored them, learned from them, worked for them, hired them. I want them to get paid what they are due, just like any other person: quiet, happiness, money, respect, understanding. I support their right to tell me when they hate (or love) something I do or say and I am totally against assholes who would pray on them or belittle them. Not because they are women, but because they are human, and no one should stand for stupid little people who only think of themselves and have a chip on their shoulder.

  And yes, women need more support than men, because they traditionally did not have it before. For them it is an uphill battle to fit into communities that contain few females. They have to butt in, they have to push and struggle and we need to understand their underdog status and protect them through that. But not because they are some fantasy creature, or perpetual victims or some **other thing** , but because they are people. This applies to them, to minorities, to majorities, to every single person around you. I would feel the same about some guy not getting hired because he is too muscular as for some woman who won't get a job because she's bland looking.

  So ask yourself, are you really supporting women, or are you just playing a game? Are you the one shouting loudly in the night "Night time! Everybody go to sleep!"? Are you protecting women or singling them out as something different that must be treated differently? Are you actually thinking of people or just doing politics? Because if you decide to annoy devs on behalf of women, you'd better do a good job supporting them for real.