teleren/devto huggingface dataset:
Open Web Intent to Tweet #100DaysOfCode Progress
Tags: python, 100daysofcode
Published: 2019-01-06 02:19:01

---
title: Open Web Intent to Tweet #100DaysOfCode Progress
published: true
description: 
tags: #python, #100DaysOfCode
---
![](https://thepracticaldev.s3.amazonaws.com/i/tcf7v4vrz7ki59urwkjl.jpeg)
A friend and I, were talking about a problem he had when he was doing #100DaysOfCode Challenge. After a couple of days he’d forget to tweet his progress. He asked me if there is a way to open twitter and post his progress in a specific time. I came with the idea of using NodeJs and create a script and a cron job in Linux to open tweeter in a specific time but we leave that project forgotten.

3 months later I made a script but using python. Here is what it does: 

1 - It loads a .json file containing the counter representing your days in the challenge, If it doesn’t exit, It’ll create a new one and started with 1.

2- Gets current date using datetime module 

3- creates a URL containing the actual date, #100DaysOfCode hashtag,the current day in the challenge and the increase in one for the next day. Using webbrowser module, opens a web intent in your default browser.


![It will opens something like this](https://thepracticaldev.s3.amazonaws.com/i/yajadix8zi2pqonjw0jm.png)


```

"""Opens a new Web Intent from Twitter to tweet your #100Daysofcode progress"""

import webbrowser 
from datetime import datetime
import os
import json

def save_day_count(file,count):
#Saves count for the next day
    try:
        with open(file,"w") as file_json:
            json.dump(count,file_json)
    except Exception as e:
        print(e)

def getting_day_count(file):
        #Check if file with current day exist
    if os.path.isfile(file):
        try:
            with open(file) as f_obj:
                #loads current day
                days = json.load(f_obj)
        except FileNotFoundError as ex :
                print(ex)
        else:   
        #Incriases one and saves for the next day
            days += 1
            save_day_count(file,days)
            return days    
    else:
        #Creates a new file if it doesn't exist and starts the counter in 1
        days = 1
        save_day_count(file,days)
        return days
        
       
days = getting_day_count("counter.json")
date = str(datetime.now().date()) #Gets current date
url = "https://twitter.com/intent/tweet?hashtags=100DaysofCode%0A" + date + "[Day " +  str(days) +"]"
webbrowser.open_new_tab(url)


```

If you are like me, you don't have to forget again to tweet your progress 


Like to the [CODE](https://github.com/cferreirasuazo/tweet-100days)

If your liked it share it or if didn't leave a feedback, I'll appreciate it.

Happy Coding!!!
How to Start Contributing to an Open Source Project?
Tags: discuss, opensource, career, beginners
Published: 2019-01-06 02:15:16

---
title: How to Start Contributing to an Open Source Project?
published: true
description: 2019 it's here, and it's time to give something back to the community. But how to start?
tags: #discuss #opensource #career #beginners
---

# How to start contributing to an Open Source project?

I've been giving this a lot of thought and, I've come to the conclusion that, just like getting married or having a child, there's no "perfect" time to start contributing to an Open Source project.

The fact is, that I have to make the time.

# I'm Ready to Go Get Some

So, I'm willing to start setting some time apart for this. But I still have a lot of questions:

* How do I choose the right project to start with?
* What if I'm not up to the challenge?
* What happens if I take too long solving an issue or something?
* What would a good roadmap to start contributing to an Open Source project be? 

By roadmap I mean:

1. Should I start with my own project? 
2. Should I start with a popular project? 
3. Should I start getting involved in Github community discussions only?

How did you start contributing? I'd really love to know how you got started ;)
2019 Dev Resolutions
Tags: webdev, career, learning, frontend
Published: 2019-01-06 01:19:46

---
title: 2019 Dev Resolutions
published: true
description: Some career goals for 2019 with new technology
tags: webdev, career, learning, frontend
---

## I'm feeling purposeful recently

I've felt particular invigorated since I got a new job last year. The people I work with are much better developers than me and that's not a bad thing. They are teaching me so much and I feel the self-taught education I gained is missing some skills to round me out.

I've come up with some things I'd love to learn in 2019 so I can understand more in our app development and that I can bring more to the table in terms of planning out apps and components better.

### Better Foundation in React

I just learned React in October. I never thought I'd be able to learn it and my new job actually taught me. It took about 2 weeks to get through the videos and then a month to feel confident in my skills. So, now in January I'm trying to brush up on the beginners principles that I may have overlooked. Then I want to ease myself into more advanced features. It's probably a strange way to do it but life comes at you fast.

### Learn Redux

I have little knowledge of Redux, my colleague is in charge of creating the actions and other Redux features. I'd love to be able to help and make my components in preparation for hooking up to Redux and getting data. In the general scheme of a life, this seems like something good to know at least basically. I'm not expecting to be an expert but to be able to hook up a system for a personal project would feel like a win for me.

### Learn About API's and NodeJS

I've made the basic API using NodeJS and Express, but I'd like to learn a bit more. This isn't the most important thing on this list but I really like learning all sides of development. The better understanding I have of the working of backend the better I feel about syncing things up with the front-end.

### Understand Technical Side of Authentication

It sounds silly, but I never really thought about authentication. Now that my eyes have been opened I'm determined to learn more about JWT (jsonWebTokens), OAuth, and any other system or version of authentication.

### Make better tests — Jest & Enzyme

This is the most important to me right now. My tests are just checking if the components render and don't crash. I'm hoping to make strides in this area because it'll be great to have components with strong tests to catch any errors I've made that could potentially effect the projects I build.

### Learn GraphQL

This seems like an upcoming technology that's about to blowup, so I'd like to stay somewhat up-to-date. I'm not sure where I'd use it right now but if people are going to be interested in it then I've got to get eyes on it.

## What Else?
Is there anything else to add to the list to become a better Front-End Developer?
A few pip tips
Tags: python, pip
Published: 2019-01-06 01:17:04

---
title: A few pip tips
published: true
description: 
tags: python,pip
---

![Photo by David Clode @ Unsplash](https://images.unsplash.com/photo-1546992772-3318f1f3a1be?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2010&q=80)

I record these tips mainly for future references, but I would be glad if you also find this post helpful. And if you have other pip tips, please comment and I will update this post.

## 1. Install packages with a specific version or version range

A specific version:

```sh
pip install foo==1.2.0
```

A version range:

```sh
pip install 'bar>=1.3.2,<=1.5.4'
```

If the same package with a different version has already been installed, the `--force-reinstall` should be used.

For multiple packages, it is better to use a `requirements.txt` file. The syntax is just the same as the single-line version above.

```txt
foo==1.2.0
bar>=1.3.2,<=1.5.4
foobar
```

Then you can run:

```sh
pip install -r requirements.txt
```

## 2. Use a mirror when downloading packages

One-time use:

```sh
pip install -i <mirror-url> foo
```

Permanent use:

```sh
pip config set global.index-url <mirror-url>
```

## 3. Use `python -m pip` instead of plain `pip`

This will ensure that you are using the correct `pip` as long as you are using the correct `python`.

Commented by:

{% user k4ml %}
A FOSS Note Taking App... with Synchronization Capabilities (Joplin)
Tags: githunt, cli, productivity
Published: 2019-01-06 00:00:47

---
title: A FOSS Note Taking App... with Synchronization Capabilities (Joplin)
published: true
description: 
cover_image: https://camo.githubusercontent.com/372ddfe5bb318ccbdd6803a8fec25b642a335a92/68747470733a2f2f6a6f706c696e2e636f7a69632e6e65742f696d616765732f416c6c436c69656e74732e6a7067
tags: githunt, cli, productivity
---

Joplin is a FOSS note taking app. I use the terminal functionalities almost exclusively, but there is a great GUI.

It's cross-platform and can sync 👀

{% github laurent22/joplin %}

If you've got a note-taking app preference, share it below so that others can get more organized too!
Reverted Ruby 2.7 new feature: Method reference operator
Tags: ruby
Published: 2019-01-05 23:08:26

---
title: Reverted Ruby 2.7 new feature: Method reference operator
published: true
description: 
tags: Ruby
---

## 2019/11/12 reverted

👋

https://github.com/ruby/ruby/commit/fb6a489af2765a3b56e301adf0019af6bbad6156
https://bugs.ruby-lang.org/issues/16275


## Method reference operator

New operator `.:` was added.
https://bugs.ruby-lang.org/issues/12125
https://github.com/ruby/ruby/commit/67c574736912003c377218153f9d3b9c0c96a17b

It converts the method to `Method` object like `method` method.

```rb
42.:to_s
# => #<Method: Integer#to_s>
```


## What is `method` method?

It converts the method to `Method` object.
https://docs.ruby-lang.org/en/trunk/Object.html#method-i-method

```rb
42.method(:to_s)
# => #<Method: Integer#to_s>
```

## What is `Method` object?

`Method` object is a pair of `receiver` and the method, it's callable like a `Proc`.
https://docs.ruby-lang.org/en/trunk/Method.html

```rb
meth = 42.method(:to_s)
# => #<Method: Integer#to_s>
meth.receiver
# => 42
meth.name
# => :to_s
meth.call
# => "42"
meth.call(16)
# => "2a"
```

## What is the differrence between Method reference operator `.:` and `method` method?

If `method` method is overwritten, `.:` still work.

```rb
class Object
  def method(*); end
end

42.method(:to_s)
# => nil
42.:to_s
# => #<Method: Integer#to_s>
```

Even if `method` method is refined, `.:` still work.

```rb
using Module.new {
  refine(Object) do
    def method(*); end
  end
}

42.method(:to_s)
# => nil
42.:to_s
# => #<Method: Integer#to_s>
```

## Is it possible to convert refined method to `Method`?

No

```rb
using Module.new {
  refine(Object) do
    def foo(*); end
  end
}

42.:foo
# undefined method `foo' for class `Integer' (NameError)
```

## How to convert the unary method to `Method`?

Add the suffix `@` like `method` method argument.

```rb
42.method(:-@).call
# => -42
42.:-@.call
# => -42
```

## Is it useful?

YES! It is useful for the API which takes the block, like methods in `Enumerable`.

```rb
[1,2,3].map { |n| 2 * n }
# => [2, 4, 6]
[1,2,3].map(&2.:*)
# => [2, 4, 6]


["NG"].any? { |word| "COPYING".include?(word) }
# => true
["NG"].any?(&"COPYING".:include?)
# => true

require "prime"

(1..10).select { |n| Prime.prime?(n) }
# => [2, 3, 5, 7]
(1..10).select(&Prime.:prime?)
# => [2, 3, 5, 7]
```

## Conclusion

You can use new syntax Method reference operator `.:` now <3

```console
$ rbenv install 2.7.0-dev
$ rbenv global 2.7.0-dev
$ ruby -e 'self.:puts.("Enjoy!")'
Enjoy!
```
Clamshell Mode with my MacBook Pro
Tags: hardware
Published: 2019-01-05 22:30:13

---
title: Clamshell Mode with my MacBook Pro
published: true
description: This week I have been playing around with using my MacBook Pro in clamshell mode, and the results have been interesting. Here’s what I learned.
tags: hardware
---

I wrote up a post on my site and felt it was appropriate to share it here as well.

## Clamshell What Now?

So let’s get the basics out the way, what is clamshell mode? This is when you are running your laptop with the lid closed and an external keyboard, mouse, and monitor are used.

## And this taught you what?

Glad you asked. So considering I almost always use an external mouse and keyboard with my laptop’s, the transition was painless. I thought at first I would miss having two screens (remember, the laptop screen is now off and closed). Not the case!

Thanks to the desktop spaces on macOS, I mostly use full-screen views for applications, so all I had to adapt to was switching spaces more often as opposed to just looking at the other monitor.

I use a Dell 27” external monitor plugged into my USB-C hub along with the keyboard, mouse, ethernet, and a couple of external hard-drives. My desktop resolution is a nice 2560x1440 so I don’t have to worry about windows jumping around when I switch back to the MacBook Pro screen. Yeah, that really bugs me too!

The most interesting thing I have learned is that my MacBook Pro runs approximately 11 degrees cooler when the lid is closed (101 degrees average), which caught me by surprise as the heat was my major concern with the lid closed (MacBook Pro 2018). Now I’m thinking this is because it only has to ask the GPU’s to power one screen instead of two, but I have no scientific data on that.

By the way, I use iStat Menus to monitor things like temperatures and fan speeds in the system bar.

My next thought was that the fans were running at a higher speed to keep the temperature down, so I checked those. Nope, still running at a nice quiet 2680rpm.

The last remaining question for some might be “But what about losing the Touch Bar on that MacBook Pro?” Well, to be honest, I barely use the thing, so it’s no big concern other than losing the touch sensor for unlocking 1Password.

## The Wrap ##

So here I am a week later, very surprised by the test results and doing a total switch around on my concerns and viewpoint on using the MacBook Pro with the lid closed. I will be doing this way more going forward to recapture some desk space. I also want to give a shout out to the Apple engineers for doing a great job on heat management.

If you have ever wondered if clamshell will work for you, I now say, give it a try you may be surprised by the results.

I am adding a vertical stand to my setup now that I know it will work for me.

A couple of reasons for my choice include the ability to change the width of the gap to support other devices in the future, plus the color matches my Space Gray MacBook Pro. Not to mention the price is great too.

Thanks for reading.
Tea Break Challenge, Day #5
Tags: career, softskills, teabreakchallenge
Published: 2019-01-05 22:06:31

---
title: Tea Break Challenge, Day #5
published: true
description: Paying attention to others
tags: career, softskills, teabreakchallenge
---

Take 3 minutes today to listen with 100% focus to someone else’s story, opinion, complaint, or celebration. Try to understand what they are feeling, thinking, and experiencing.

http://tea.is/d/5
Minimal (yes, truly) TypeScript setup
Tags: typescript, javascript, beginners
Published: 2019-01-05 21:55:13

---
title: Minimal (yes, truly) TypeScript setup
published: true
description: A genuinely minimal repository to try TypeScript on a website with
tags: typescript, javascript, beginners
---

One of the most frustrating things _ever_ is wanting to try something out and having to install a million things and learn 3.14 new tools just to get something runnable in your browser.

I wrote up a [minimal server and repository](https://github.com/aleph-naught2tog/ts_without_dependencies) for a project that compiles your TypeScript down for use in a browser environment, so that people can try TypeScript if they want, without worrying about things like loaders, webpack, etc.

{% github https://github.com/aleph-naught2tog/ts_without_dependencies %}

Its _only_ dependency is TypeScript itself. Literally. (Well, okay, Node too, but TypeScript itself uses Node, so I think that's permissible.)

If all you want is to try a basic website with TypeScript, this is perfect for that. 

If you want to try writing your own server, please use this as a base if you want -- I included notes in the server files, let me know if anything is unclear! -- but if you want nothing to do with the server, you shouldn't need to mess with its code.
Describe Your Tetris Effect
Tags: discuss
Published: 2019-01-05 20:43:38

---
title: Describe Your Tetris Effect
published: true
description: 
tags: discuss
cover_image: https://thepracticaldev.s3.amazonaws.com/i/jyiconlqicqubq0vqhgw.png
---

The [Tetris Effect](https://en.wikipedia.org/wiki/Tetris_effect) occurs when people devote so much time and attention to an activity that it begins to pattern their thoughts, mental images, and dreams. It takes its name from the video game Tetris.

> People who played Tetris for a prolonged amount of time could find themselves thinking about ways different shapes in the real world can fit together, such as the boxes on a supermarket shelf, the buildings on a street, or hallucinating pieces being generated and falling into place on an invisible layout. In this sense, the Tetris effect is a form of habit. They might also dream about falling tetrominos when drifting off to sleep or see images of falling tetrominos at the edges of their visual fields or when they close their eyes. In this sense, the Tetris effect is a form of hypnagogic imagery. 

So do you experience Tetris Effect in your life as a software developer? I know I do. Share!ter
What resources would you recommend to learn Perl?
Tags: perl, discuss, help
Published: 2019-01-05 19:23:10

---
title: What resources would you recommend to learn Perl?
published: true
description: My primary language is C#, but I also have some experience in JS, Java... I'm looking for a site/book/course with a practical approach to jumpstart my learning of Perl.Any recommendations?
tags: Perl, discuss, help
---

I got a new job as a Perl back-end developer. I have been working as a back-end developer for the last 3 years primarily in C#, but I also have some experience in JS and Java. I have read Perl docs a few months ago, and I have written some small exercises but I still feel there is something missing. 

I'm looking for a site/book/course with a practical approach (exercises, challenges etc.) to jumpstart my learning process this time. What would you recommend?

Looking forward to reading your suggestions :)
Using MobX with React Hooks
Tags: mobx, react, hooks, javascript
Published: 2019-01-05 18:59:11

---
title: Using MobX with React Hooks
published: true
description: A simple example of how we can use Mobx (a truly awesome state management library) with React Hooks
tags: Mobx, React, Hooks, JavaScript
series: mobx-hooks
---

This post assumes familiarity with MobX.

#### Hooks have drastically changed the way we can write functional components in React.

This proposal has brought a huge change in a way we would write functional components. Combining this with a state management lib like [MobX](https://mobx.js.org/), it is too easy to manage you app state and never write a class component ever again.

For React, we get official bindings via the `mobx-react` package. But for hooks, we need to use another library [mobx-react-lite](https://github.com/mobxjs/mobx-react-lite). This gives us custom hooks with which we can create observables directly in our components.

A simple example is shown below:
{% codesandbox 8y05z5p4q8 %}

Here, the hook `useObservable` gives us a new way of creating observables, actions and computed properties all in one object. The required values can be accessed on this object and the component reacts to changes via the `observer` wrapper.

Now you might be wondering, what if I have state that needs to be shared across components? `mobx-react-lite` doesn't include a `Provider` but we don't need it anymore as React already has that pattern... Context!

Context is the way we can share state across multiple components without techniques like lifting state up or prop-drilling. React now provides a hook called `useContext` that can help us share our MobX store across multiple components.

Here is the same example featuring the classic MobX store defined as a class and being used via context.

{% codesandbox 3kmkj56qm %}

If you view the `TodoStore.js` file, you can see that it is how you would normally define a MobX store. A context is created out of an instance of this store and this now can be shared across multiple components. Easy!

I will write a follow-up post on how to test these components. Thanks for reading!
Hello Internet
Tags: 2019, goals, lessons
Published: 2019-01-05 18:13:22

---
title: Hello Internet
published: True
description: Making a 2019 Resolution of making a post a week to share my learnings with the my internet friends.
tags: 2019, goals, lessons
---
Welcome to my space on the internet! This post is the first of many to come this year. One of my resoultions for the year of 2019 is to blog at least once a week. Feel free to provide me feedback on my posts or portfolio at any of the provided social media accounts provided on the navigation bar. As the first post of the current year I would like to use this post to kind of brain dump some of the ideas I had for the upcoming year!

Goals:
+ Finally start branding myself on the internet so can build my street creds :D

+ Give me a weekly motivation to step outside my comfort zone and learn something new

+ Figure out methods to engage with more people outside my current circle

+ Share my thoughts with the world
Ideas:
+ Recently switched projects within my current employer, talk about some of the lessons I have learned.

+ Share my current Workout Routine(one of the resoultions I have successfully achieved from last year).

+ Share some of the projects I'm currently working on to help improve my routines(code, lifestyle, etc.)

+ Build a engagement stream with users and figure out other weekly topics they would like to see posts about.

Well that's all I have for this post folks. Make sure you keep an eye out for weekly updates from me! 

Webpage coming soon!
What do you think of Visual Studio Live Share for multi-user editing?
Tags: discuss, tips, editors, help
Published: 2019-01-05 17:18:28

---
title: What do you think of Visual Studio Live Share for multi-user editing?
published: true
description: I'm looking into [Visual Studio Live Share](https://visualstudio.microsoft.com/services/live-share/) and need some advice!
tags: discuss, tips, editors, help
---

Hello Dev.Tovians!

I'm looking into [Visual Studio Live Share](https://visualstudio.microsoft.com/services/live-share/) as a mechanism for doing some lower-latency remote pairing without requiring as much screen sharing. (which is slow!)

I'm curious what (if any) challenges you encountered while:

* Setting it up 
* Granting access
* Using it for extended periods of time
* Adding new people/dropping people in the middle of the session

In the past, I've tried similar tools and the issues I've run into were:

* "Oh no it stopped working but it was invisible"
* "Wait, the test failed? Oh! They were running against the version that hadn't been updated yet!"
* "Yeah, all the code isn't on your computer yet because we haven't opened them in the editor..."

My hope is that with Microsoft (who has traditionally been very good at dev tooling) throwing their weight behind a multi-user-code-editor it'll be a touch more consistently usable than the well-intentioned but underfunded hobby-projects I've used in the past.

Any experiences you can share or tips for a noobie getting started with it?