teleren/devto huggingface dataset:
I made two new web tools with React and Django, and here's my experience!
Tags: webdev, programming, react, django
Published: 2022-06-03 00:07:31

I am a independent developer, and I have developed tons of web tools with my Django skills but I learnt React and Next Js, and here's my story...

## Why independent development?
There are tons of reason you should try independent development, and some reason I started independent development is...
It gives your child a sense of importance and belonging which is essential for building confidence and for contributing to the community. Also, it develops a vibe of ownership within you.

## Initial development of my web apps / tools
Well, initially I used Django only for the development and deployed the webapps in the server. But really there's a reason I used Django for it... The reason is I was learning Django for the sole purpose of making those webapps, and I knew no other web frameworks.
Com'n, Django is by far the easiest and the fastest web framework I've ever tested. 
I didn't had to worry about the CSRF and other security stuff of my web app, 'cause the data I displayed was scraped from somewhere else.

Some of my very common/new web apps...

1. [YouTube Tag Generator](https://apps.webmatrices.com/platforms/youtube-tag-generator)
2. [Related Keyword Generator](https://apps.webmatrices.com/generator/related-keyword-generator)
3. [Linkedin Hashtags Generator](https://apps.webmatrices.com/social-media/linkedin-hashtag-generator)

## Switching to React and Next Js
Actually, I didn't completely switched to React/NextJs, I only switched the front-end part of my web apps. The back-end still is in Django.

### Challenge
I had to secure my web apps in such a way that it doesn't leaks the back-end part, I didn't wanted the backend to be public.
Then, I tried using the API of Next Js, and requested the Django server with it. Also, using CSRF became easy because of that. I used a package named [next-csrf](https://www.npmjs.com/package/next-csrf) for this task.

## The Best Part
The best part is that with all of this hustle and hard work, it's going to pay me off with nice **Google Adsense** revenue. [NFT Name Generator](https://apps.webmatrices.com/generator/nft-name-generator) is one of my most popular web app. And, I it's paying my nice.

Thanks for being with me, have a good day!
Longest Common Prefix
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 00:00:47

Write a function to find the longest common prefix string amongst an array of strings.

If there is no common prefix, return an empty string `""`.

**Example 1:**

**Input:** strs = \["flower","flow","flight"\]
**Output:** "fl"

**Example 2:**

**Input:** strs = \["dog","racecar","car"\]
**Output:** ""
**Explanation:** There is no common prefix among the input strings.

**Constraints:**

*   `1 <= strs.length <= 200`
*   `0 <= strs[i].length <= 200`
*   `strs[i]` consists of only lower-case English letters.

**SOLUTION:**

    # class Solution:
    #     def longestCommonPrefix(self, strs: List[str]) -> str:
    #         k = min([len(s) for s in strs])
    #         i = 0
    #         while i <= k and len(set([s[:i] for s in strs])) == 1:
    #             i += 1
    #         return strs[0][:i-1]
    
    # class Solution:
    #     def longestCommonPrefix(self, strs: List[str]) -> str:
    #         n = len(strs)
    #         prefixes = {}
    #         for s in strs:
    #             for i in range(len(s) + 1):
    #                 prefixes[s[:i]] = prefixes.get(s[:i], 0) + 1
    #         return max([(len(k), k, v) for k, v in prefixes.items() if v == n])[1]
    
    # class Solution:
    #     def longestCommonPrefix(self, strs: List[str]) -> str:
    #         k = min([len(s) for s in strs])
    #         i = 0
    #         while i < k and len(set([s[i] for s in strs])) == 1:
    #             i += 1
    #         return strs[0][:i]
    
    class Solution:
        def isLCP(self, strs, k):
            return len(set([s[:k] for s in strs])) == 1
    
        def longestCommonPrefix(self, strs):
            n = len(strs)
            if n == 0:
                return ""
            beg = 0
            end = min([len(s) for s in strs])
            while beg <= end:
                mid = (beg + end) // 2
                currval = self.isLCP(strs, mid)
                nextval = self.isLCP(strs, mid + 1)
                if (currval and not nextval) or mid >= end:
                    return strs[0][:mid]
                elif beg == end:
                    break
                elif currval and nextval:
                    beg = mid + 1
                else:
                    end = mid
            return ""
Recommended podcasts
Tags: bookmarks, podcast
Published: 2022-11-01 22:21:44

---
title: Recommended podcasts
published: true
date: 2022-06-03 00:00:00 UTC
tags: bookmarks,podcast
canonical_url: https://qjuanp.dev/post/recommended-podcasts-en
---

Here is the non-requested podcast lists around Software Development.

| Podcast | Link | Review |
| --- | --- | --- |
| Maintainable | [maintainable.fm](https://www.maintainable.fm) | Conversations with developers and engineers around maintain and evolve software. Important topic of you consider committed code as legacy code! |
| CaSE: Conversations about Software Engineering | [vase-podcast.org](https://www.case-podcast.org) | Interviewing developers and architects about software engineering and development. |
| Software Engineering Radio | [se-radio.net](https://www.se-radio.net) | Engineers talking about their experience around different topics around building software. |
| Soft Skills Engineering | [softskills.audio](https://softskill%C3%B1s.audio) | Not everything is code and tools when we talk about software development. |
| Developer tea | [developertea.com](https://developertea.com) | This podcast focus as well in the human part of develop software. |
| Dev Discussions | [Apple podcast](https://podcasts.apple.com/ie/podcast/dev-discussions/id954824483) | Conversations around topics around software development, techniques and patterns. |

My DMs on twitter are open [@qjuanp](https://twitter.com/qjuanp) feel free to recommend me more podcasts! I’m looking for comedy (international and local Irish comedy for foreigners) and interesting stories in this format. Thanks!
Unwatch All Repositories in a GitHub Organization
Tags: github, gh, automation
Published: 2022-06-14 22:42:34

---
title: Unwatch All Repositories in a GitHub Organization
published: true
date: 2022-06-03 00:00:00 UTC
tags: github, gh, automation
canonical_url: https://justin.poehnelt.com/posts/unwatching-all-repos-in-github-org/
---

I am currently changing teams at Google and need to unsubscribe from all repositories in my former GitHub organization. This is possible to do at [github.com/watching](http://github.com/watching), but as always, I want to avoid a bunch of clicks. This will require a few steps:

1. Find existing subscriptions using the Github API.
2. Filter out subscriptions that are not in the organization.
3. Unsubscribe from each repository.

I’m planning to use the [GitHub cli](https://cli.github.com/) to make this a little smoother.

```
gh api --paginate "https://api.github.com/user/subscriptions" |
  | jq '.[] | .full_name' \
  | grep googlemaps \
  | sort
```

I was subscribed to the following repositories in the GitHub organization.

```
"googlemaps/.github"
"googlemaps/android-maps-rx"
"googlemaps/android-places-ktx"
"googlemaps/google-maps-services-go"
"googlemaps/google-maps-services-python"
"googlemaps/googlemaps.github.io"
"googlemaps/js-api-loader"
"googlemaps/js-jest-mocks"
"googlemaps/js-markerclustererplus"
"googlemaps/js-markermanager"
"googlemaps/js-markerwithlabel"
"googlemaps/js-ogc"
"googlemaps/js-polyline-codec"
"googlemaps/js-samples"
"googlemaps/js-three"
"googlemaps/js-types"
"googlemaps/openapi-specification"
"googlemaps/react-wrapper"
"googlemaps/v3-utility-library"
```

Now all I had to do was pipe this into another `gh api` command to delete the subscription.

```
gh api --paginate "https://api.github.com/user/subscriptions" |
  | jq '.[] | .full_name' \
  | grep googlemaps \
  | xargs -I {} \
    gh api \
      -X DELETE \
      "https://api.github.com/repos/{}/subscription"
```

Now when I go to one of the repositories, I see that I am only subscribed to “Participating and @mentions” instead of “All Activity”.

[![GitHub watch notifications menu](https://justin.poehnelt.com/images/github-notifications-W3e--NxT1f-200.jpeg)](https://justin.poehnelt.com/images/github-notifications-W3e--NxT1f-200.jpeg)

GitHub watch notifications menu

**Note** : The REST api docs are at [https://docs.github.com/en/rest/activity/watching#delete-a-repository-subscription](https://docs.github.com/en/rest/activity/watching#delete-a-repository-subscription).
It's not valuable until the user can use it
Tags: lean, waste, storyslicing
Published: 2022-11-09 16:03:43

---
title: It's not valuable until the user can use it
published: true
cover_image: https://jhall.io/images/bn-retail-warehouse.jpg
date: 2022-06-03 00:00:00 UTC
tags: lean,waste,storyslicing
canonical_url: https://jhall.io/archive/2022/06/03/its-not-valuable-until-the-user-can-use-it/
---

What have you been working on lately? How close is it to done?

20%? 50%? 80%?

Until it’s in front of the intended user of the thing, it may as well be 0% done.

In the manufacturing and retail businesses, products that are not yet in front of the user are called “inventory.” Inventory is one of the specifically identified areas of waste in Lean.

How can you reduce or eliminate inventory waste in your software delivery?

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Strava Webhooks with Stokehook.com
Tags: strava, webhooks
Published: 2022-06-14 22:41:49

---
title: Strava Webhooks with Stokehook.com
published: true
date: 2022-06-03 00:00:00 UTC
tags: strava, webhooks
canonical_url: https://justin.poehnelt.com/posts/strava-webhooks-with-stokehook/
---

I recently implemented a small application, [Stokehook.com](https://stokehook.com/), that can send webhooks for your Strava activities to any endpoint. Getting data out of Strava as it is uploaded has never been easy to do and I wanted to fix that in a way that lets other developers integrate the activities into other workflows.

[![Stokehook.com](https://justin.poehnelt.com/images/social-KWmnT9t1Jl-200.jpeg)](https://justin.poehnelt.com/images/social-KWmnT9t1Jl-600.jpeg)

Stokehook.com

## Tech Stack

- Svelte + Sveltekit
- TailwindCSS
- Firestore
- Firebase Auth
- Hosted on Netlify (easier than Firebase functions and hosting for now)

## How it works

The app basically does the following.

1. Handle authentication with Strava
2. Receives a webhook from Strava for all app users
3. Looks up the webhook setting for the user
4. Refreshes the access token for the user
5. Enriches the webhook with the full object (Strava sends minimal information in their webhook)
6. Sends it off to the user’s endpoint

The interface for the app is pretty simple.

[![Settings](https://justin.poehnelt.com/images/stokehook-settings-2s9Y04LKrc-200.jpeg)](https://justin.poehnelt.com/images/stokehook-settings-2s9Y04LKrc-600.jpeg)

Settings

## Payload

The key feature is that Strava sends a “thin” webhook with minimal fields for the activity. The app gets all fields for the object via the Strava API before sending it along.

So instead of:

```
{
  "aspect_type": "create",
  "event_time": 1654224986,
  "object_id": 7246184314,
  "object_type": "activity",
  "owner_id": 2170160,
  "subscription_id": 217592,
  "updates": {},
}
```

The payload ends up looking like:

```
{
  "aspect_type": "create",
  "event_time": 1654224986,
  "object_id": 7246184314,
  "object_type": "activity",
  "owner_id": 2170160,
  "subscription_id": 217592,
  "updates": {},
  "data": {
    "resource_state": 3,
    "athlete": {
      "id": 2170160,
      "resource_state": 1
    },
    "name": "Evening Hike",
    "distance": 2077.3,
    "moving_time": 1700,
    "elapsed_time": 1843,
    "total_elevation_gain": 25,
    "type": "Hike",
    "id": 7246184314,
    "start_date": "2022-06-03T02:22:32Z",
    "start_date_local": "2022-06-02T20:22:32Z",
    ...
    "pr_count": 0,
    "total_photo_count": 0,
    "has_kudoed": false,
    "suffer_score": 2,
    "description": null,
    "calories": 99,
    "perceived_exertion": null,
    "prefer_perceived_exertion": null,
    "segment_efforts": [],
    ...
    "available_zones": [
      "heartrate"
    ]
  },
  "meta": {
    "id": "FDnZJ5smHVVPYQAVOrq3",
    "url": "https://webhook.site/633a324a-eec8-46d1-9bb8-d7b7ca0d90b5"
  }
}
```

Try it out at [Stokehook.com](https://stokehook.com/)!
Web3 Solidity + JavaScript 32 hour course recap #7
Tags: web3, solidity, remix, blockchain
Published: 2022-06-02 23:54:18

timestamps: 2:23:32-2:44:10

This is the recap of my sixth day of making my way through the 32 hour course by Patrick Collins posted on [FreeCodeCamp](https://www.youtube.com/watch?v=gyMwXuJrbJQ).

I really like the more hands-on portions of these tutorials.

I learned that there are 4 ways to set the visibility specifiers: internal, external, public, and private. If it is not specified, then it is internal. External functions are only available externally, internal functions are only available to the contract and the contract's children.

We learned more about arrays and structures. The naming convention of person vs Person vs people vs People is rather confusing. But, in general, the definition of what a Person object looks like feels like a typescript interface. Then you can define Person[], as an array that contains the objects of single a single person. 

It was a good day, and I learned a lot!
[Desafio] - Processar Arquivos Grandes com Restrição de Memória
Published: 2022-06-02 23:36:22

> Conteúdo original [nessa thread do Twitter](https://twitter.com/zanfranceschi/status/1532505851658784768)

---

Ei dev,

Aceita um desafio pra lidar com restrição de memória?

- Gere um arquivo várias linhas com cerca de 100MB de tamanho;
- Faça um programa que leia esse arquivo e printe o resultado como na imagem;
- Dockerize ele e o execute com limite de memória de 20m;

cc @sseraphini

![img](https://pbs.twimg.com/media/FUSN8vgVUAALPTo?format=jpg&name=small)

---

O principal desafio aqui é trabalhar com um arquivo que não caiba na memória do processo. Usar o Docker é apenas uma sugestão para limitar a memória; se você conhece outros meios de fazer isso, manda bala!

Ah, os valores de tamanho de arquivo e memória são apenas uma sugestão.

---

Note que se for realmente usar o Docker, terá que copiar o arquivo para a imagem :)

[Dockerfile]
COPY arquivo-grande.txt diretorio-docker/
Reverse String
Tags: leetcode, dsa, theabbie
Published: 2022-06-02 23:30:36

Write a function that reverses a string. The input string is given as an array of characters `s`.

You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with `O(1)` extra memory.

**Example 1:**

**Input:** s = \["h","e","l","l","o"\]
**Output:** \["o","l","l","e","h"\]

**Example 2:**

**Input:** s = \["H","a","n","n","a","h"\]
**Output:** \["h","a","n","n","a","H"\]

**Constraints:**

*   `1 <= s.length <= 105`
*   `s[i]` is a [printable ascii character](https://en.wikipedia.org/wiki/ASCII#Printable_characters).

**SOLUTION:**

    class Solution:
        def reverseString(self, s: List[str]) -> None:
            n = len(s)
            for i in range(n // 2):
                s[i], s[n - i - 1] = s[n - i - 1], s[i]
June 2nd, 2022: What did you learn this week?
Tags: weeklyretro, weeklylearn, discuss
Published: 2022-06-02 23:24:29

It's that time of the week again. So wonderful devs, what did you learn this week? It could be programming tips, career advice etc.

![Image of the brain](https://media.giphy.com/media/ojmB7lOn3VUU8/giphy.gif)

Feel free to comment with what you learnt and/or reference your TIL post to give it some more exposure.

{%tag todayilearned %}

Photo by [Joshua Dow](https://unsplash.com/@jmdphotography?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
Consistent Hashing Simulator
Tags: javascript, devops
Published: 2022-06-02 23:24:04

[Consistent Hashing](https://www.toptal.com/big-data/consistent-hashing) is a distributed hashing scheme that operates independently of the number of servers or objects in a distributed hash table.


![Consistent Hashing Simulator](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/32rp19bzmo4ez9bk15p4.png)

I made a [Consistent Hashing Simulator](https://ionmx.dev/demos/consistent-hashing-simulator/) to help to understand the concept. Basically it takes random strings (titles from wikipedia) and applies the hash function, you can see load per server and add/remove servers to see how keys move between servers.
Update Table in Laravel Migrations
Tags: laravel, webdev, beginners, tutorial
Published: 2022-06-02 23:19:42

Here, i have come with another small piece of code which you can use in updating your laravel existing migrations.

Run this command to create migration
```ssh
php artisan make:migration update_users_table
```

```php
<?php
 
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
 
class UpdateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
        $table->string('name', 255)->nullable(true)->change();
        $table->renameColumn('first_name', 'full_name');
        $table->dropColumn('age');
        $table->string('email')->unique()->change();
        $table->integer('gender');
    });
    }
 
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {
        $table->string('name', 255)->nullable(false)->change();
        $table->renameColumn('full_name', 'first_name');
        $table->integer('age');
        $table->dropUnique('email');
        $table->dropColumn('gender');
    });
    }
};
```
Now run this command
```ssh
run the command php artisan migrate
```
---
Please like share and give positive feedback to motivate me to write more.

For more tutorials [visit my website](https://www.w3courses.org/category/code-examples/).

Thanks:)
Happy Coding:)
Grokking Partial Application
Tags: functional, math, hard, javascript
Published: 2022-06-02 23:03:10

If you started programming in an imperative language such as Java like I did, learning to grok functional programming can be a daunting endeavor.

What partial application, or known by some as "currying" after the late mathematician Haskell Curry, is applying a function to a value, which returns another function yet to be applied to another value.

Look at the following function in JavaScript:

```javascript
const add = (a) => (b) => x + y
```

As you first apply this function to the first number 9, it replaces `a` and returns the function `(b) => 9 + b`:

```javascript
const addNine = add(9)
// -> (9) => (b) => 9 + n2
// -> (b) => 9 + n2
```

We end up with a half-applied function `addNine` that, when applied to another number, will add it to number 9 which is being stored on the stack. In another word, the computation was being suspended until the next application.

This is indeed different from the following function:

```javascript
const add = (a, b) => a + b
```

If we partially applied this function to a single value 5,`a` would be substituted with a number while `b` will be undefined, resulting in an execution of `5 + undefined` which equals to `NaN`, a very obscure result to ever be returned by a language. 

Functions in functional languages such as Ocaml and Haskell are curried, which means they apply to each value at a time no matter how many parameters they have. Take these two Haskell functions, which are similar:

```haskell
add1 :: Int -> Int -> Int
add1 a b = a + b

add2 :: Int -> Int -> Int
add2 a = \b -> a + b
```

The line above each function's definition is the function's type declaration. They show that both functions are in fact the same—a two-step application process to the end value.
Closest Divisors
Tags: leetcode, dsa, theabbie
Published: 2022-06-02 23:00:47

Given an integer `num`, find the closest two integers in absolute difference whose product equals `num + 1` or `num + 2`.

Return the two integers in any order.

**Example 1:**

**Input:** num = 8
**Output:** \[3,3\]
**Explanation:** For num + 1 = 9, the closest divisors are 3 & 3, for num + 2 = 10, the closest divisors are 2 & 5, hence 3 & 3 is chosen.

**Example 2:**

**Input:** num = 123
**Output:** \[5,25\]

**Example 3:**

**Input:** num = 999
**Output:** \[40,25\]

**Constraints:**

*   `1 <= num <= 10^9`

**SOLUTION:**

    class Solution:
        def closestDivisors(self, num: int) -> List[int]:
            closest = (1, num + 1)
            for x in [num + 1, num + 2]:
                curr = (1, x)
                i = 2
                while i * i <= x:
                    if x % i == 0:
                        curr = (i, x // i)
                        if curr[1] - curr[0] < closest[1] - closest[0]:
                            closest = curr
                    i += 1
            return closest
Interview Prep Fireside Chat with a Senior Meta Engineer
Tags: eventdriven, programming, career, techtalks
Published: 2022-06-02 22:58:18

Join us for a fireside chat with another **[Hackpack](https://www.hackpack.io/)** alumni who got a job at Meta! If you are interested in Meta or currently studying for programming interviews, this will be a great opportunity to learn and get advice for your own career journey.

The event will be held over discord next Thursday 6/9: https://discord.gg/NKFGEzav5M?event=981724643624882186
Verifying an Alien Dictionary
Tags: leetcode, dsa, theabbie
Published: 2022-06-02 22:30:40

In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different `order`. The `order` of the alphabet is some permutation of lowercase letters.

Given a sequence of `words` written in the alien language, and the `order` of the alphabet, return `true` if and only if the given `words` are sorted lexicographically in this alien language.

**Example 1:**

**Input:** words = \["hello","leetcode"\], order = "hlabcdefgijkmnopqrstuvwxyz"
**Output:** true
**Explanation:** As 'h' comes before 'l' in this language, then the sequence is sorted.

**Example 2:**

**Input:** words = \["word","world","row"\], order = "worldabcefghijkmnpqstuvxyz"
**Output:** false
**Explanation:** As 'd' comes after 'l' in this language, then words\[0\] > words\[1\], hence the sequence is unsorted.

**Example 3:**

**Input:** words = \["apple","app"\], order = "abcdefghijklmnopqrstuvwxyz"
**Output:** false
**Explanation:** The first three characters "app" match, and the second string is shorter (in size.) According to lexicographical rules "apple" > "app", because 'l' > '∅', where '∅' is defined as the blank character which is less than any other character ([More info](https://en.wikipedia.org/wiki/Lexicographical_order)).

**Constraints:**

*   `1 <= words.length <= 100`
*   `1 <= words[i].length <= 20`
*   `order.length == 26`
*   All characters in `words[i]` and `order` are English lowercase letters.

**SOLUTION:**

    class Solution:
        def isSorted(self, nums):
            n = len(nums)
            for i in range(n - 1):
                if nums[i] > nums[i + 1]:
                    return False
            return True
        
        def isAlienSorted(self, words: List[str], order: str) -> bool:
            pos = {}
            for i, c in enumerate(order):
                pos[c] = i
            return self.isSorted([tuple([pos.get(c, 0) for c in word]) for word in words])