teleren/devto huggingface dataset:
Build Cooking Website Using Badaso - Part 1
Tags: badaso, laravel, adminpanel, apicrud
Published: 2022-06-04 17:03:29

---
title: Build Cooking Website Using Badaso - Part 1
published: true
description: Laravel headless CMS, admin panel, dashboard, builder and API CRUD
tags: badaso,laravel,adminPanel,apiCrud
# cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nxf4i5abgdmdxmroau3s.png
# Use a ratio of 100:42 for best results.
---

Badaso is one of wonderfull Laravel package. It's contain Laravel headless CMS, admin panel, dashboard, builder and API CRUD.
Badaso is open source 100% free, maintain by [Uasoft](https://soft.uatech.co.id/). If you are curious, go directly to the official [Badaso page](https://badaso.uatech.co.id/).

## 1. Installation
Badaso support installation witout Docker or with Docker. In this time, We try install Badaso witout Docker.
Install Badaso is easy. Open terminal and run it `curl -s "https://badaso-starter.uatech.co.id/your-project-name" | bash`.
We change `…/your-project-name` with `…/cookings`.
```bash
curl -s "https://badaso-starter.uatech.co.id/cookings" | bash
```
It will install the Laravel starter project and Badaso it self at a time. If process installation are done, the terminal look below.
![install badaso](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v1brjm7rfft1z253zif2.jpg)
Ok, now we go to the project `cd cookings` and `php artisan serve`. If we not got the error, our browser look Badaso's Welcome Page.
![badaso](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w3bylrh7e51ko9uvbsn7.jpg)
## 2. Setup Dashboard
Since we have installed Badaso at step 1, We haven't configured the database yet. This is proven when we enter the dashboard page `http://localhost:8000/badaso-dashboard`, we got an error.
![screen1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m31ew0bigga9gncnbaj4.jpg)
Now we setup several stuff. Before it, make sure your `composer.json` have `badaso/core`.
```json
"require": {
  "php": "^8.0.2",
  "badaso/core": "^2.4",
  ...
},
```
Open `.env` file, and fill it according to your environment
```env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=cookings
DB_USERNAME=root
DB_PASSWORD=123456
```
Don't forget you to create a database first via mysql-client or phpmyadmin.

Run commands below one by one.
```bash
php artisan badaso:setup
php artisan migrate
php artisan storage:link
php artisan db:seed --class="Database\Seeders\Badaso\BadasoSeeder"
php artisan badaso:admin admin@admin.com --create
npm install && npm run dev
```
Last run the server
```bash
php artisan serve
```
Refresh page at `http://localhost:8000/badaso-dashboard` and at the final we can see the badaso dashboard.
![badaso dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/szv75umlokw3nyjbw7um.jpg)

Until here we have actually successfully installed badaso dashboard.
For the next chapter, we will continue in another post.

_Continue..._
Reverse Words in a String III
Tags: leetcode, dsa, theabbie
Published: 2022-06-04 17:00:45

Given a string `s`, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.

**Example 1:**

**Input:** s = "Let's take LeetCode contest"
**Output:** "s'teL ekat edoCteeL tsetnoc"

**Example 2:**

**Input:** s = "God Ding"
**Output:** "doG gniD"

**Constraints:**

*   `1 <= s.length <= 5 * 104`
*   `s` contains printable **ASCII** characters.
*   `s` does not contain any leading or trailing spaces.
*   There is **at least one** word in `s`.
*   All the words in `s` are separated by a single space.

**SOLUTION:**

    class Solution:
        def reverseWords(self, s: str) -> str:
            s = list(s) + [""]
            chunk = ""
            op = ""
            for c in s:
                if c == " " or c == "":
                    op += chunk
                    op += c
                    chunk = ""
                else:
                    chunk = c + chunk
            return op
Find Git Branching Point Between Branch
Tags: beginners, git
Published: 2022-06-05 10:08:16

---
title: Find Git Branching Point Between Branch
published: true
date: 2022-06-04 17:00:17 UTC
tags: Beginner,git
series: "Sunday Snippet"
canonical_url: https://clavinjune.dev/en/blogs/find-git-branching-point-between-branch/
---

 ![Sunday Snippet #20 find git branching point between branch](https://clavinjune.dev/img/sunday-snippet/image.png "Sunday Snippet #20 find git branching point between branch")

```shell
➜  pet git:(master) git --no-pager log --oneline -1
2422e70 (HEAD -> master, origin/master) update README.md
➜  pet git:(master) git checkout -b testing
Switched to a new branch 'testing'
➜  pet git:(testing) git commit --allow-empty -sam "first"
[testing 8210c2d] first
➜  pet git:(testing) git commit --allow-empty -sam "second"
[testing feb9b4f] second
➜  pet git:(testing) git commit --allow-empty -sam "third"
[testing 7120047] third
➜  pet git:(testing) git --no-pager log --oneline -4
7120047 (HEAD -> testing) third
feb9b4f second
8210c2d first
2422e70 (origin/master, master) update README.md
# how to get this branching point (2422e70) from `testing` branch?
# git rev-list --boundary branch1...branch2 | grep "^-" | cut -c2-
➜  pet git:(testing) git rev-list --boundary testing...master  | grep "^-" | cut -c2-
2422e70001b80d186fdd1df1a9227dc3d8e0061e
```
Minimize Deviation in Array
Tags: leetcode, dsa, theabbie
Published: 2022-06-04 12:30:35

You are given an array `nums` of `n` positive integers.

You can perform two types of operations on any element of the array any number of times:

*   If the element is **even**, **divide** it by `2`.
    *   For example, if the array is `[1,2,3,4]`, then you can do this operation on the last element, and the array will be `[1,2,3,2].`
*   If the element is **odd**, **multiply** it by `2`.
    *   For example, if the array is `[1,2,3,4]`, then you can do this operation on the first element, and the array will be `[2,2,3,4].`

The **deviation** of the array is the **maximum difference** between any two elements in the array.

Return _the **minimum deviation** the array can have after performing some number of operations._

**Example 1:**

**Input:** nums = \[1,2,3,4\]
**Output:** 1
**Explanation:** You can transform the array to \[1,2,3,2\], then to \[2,2,3,2\], then the deviation will be 3 - 2 = 1.

**Example 2:**

**Input:** nums = \[4,1,5,20,3\]
**Output:** 3
**Explanation:** You can transform the array after two operations to \[4,2,5,5,3\], then the deviation will be 5 - 2 = 3.

**Example 3:**

**Input:** nums = \[2,10,8\]
**Output:** 3

**Constraints:**

*   `n == nums.length`
*   `2 <= n <= 5 * 104`
*   `1 <= nums[i] <= 109`

**SOLUTION:**

    import heapq
    
    class Solution:
        def minimumDeviation(self, nums: List[int]) -> int:
            pq = []
            for a in nums:
                heapq.heappush(pq, [a // (a & -a), a])
            res = float('inf')
            ma = max(a for a, a0 in pq)
            while len(pq) == len(nums):
                a, a0 = heapq.heappop(pq)
                res = min(res, ma - a)
                if a % 2 == 1 or a < a0:
                    ma = max(ma, a * 2)
                    heapq.heappush(pq, [a * 2, a0])
            return res
Reverse Vowels of a String
Tags: leetcode, dsa, theabbie
Published: 2022-06-04 16:30:38

Given a string `s`, reverse only all the vowels in the string and return it.

The vowels are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`, and they can appear in both cases.

**Example 1:**

**Input:** s = "hello"
**Output:** "holle"

**Example 2:**

**Input:** s = "leetcode"
**Output:** "leotcede"

**Constraints:**

*   `1 <= s.length <= 3 * 105`
*   `s` consist of **printable ASCII** characters.

**SOLUTION:**

    class Solution:
        def reverseVowels(self, s: str) -> str:
            n = len(s)
            vows = {'a',  'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'}
            stack = []
            s = [c for c in s]
            for i in range(n):
                if s[i] in vows:
                    stack.append(s[i])
                    s[i] = -1
            for i in range(n):
                if s[i] == -1:
                    s[i] = stack.pop()
            return "".join(s)
starting my blogs day #1
Tags: blog, beginners, discuss, codenewbie
Published: 2022-06-04 16:29:31

Hello to everyone who is reading my blog and if you are coming here after watching my youtube video sorry because I said that these blogs are gonna start 3 days earlier than when I am currently uploading these blogs it was because I had some problems with my computer so now let's get started with the blog so firstly I didn't code every single day I did coded normally for the first 2 days and on the 3rd day I spend most of the time outside the house but I did code a little today and currently I'm creating this blog after coding for 45 minutes and I don't know if doing 60 steps in 3 days a good thing but I did that so if you think that is normal or good you can comment here or my youtube channel and some things/tags in HTML 
I learned are - lists , functions, sections , img, and many more
if you liked this blog you can follow my account and subscribe to my youtube channel mako the coder.
How to generate Random Flags of Countries ?
Tags: flag, random, country, webdev
Published: 2022-06-04 16:24:54

We’ll use a random flag generator to create some flags that you might find somewhere in the world (more specifically, countries) but are not the flags of any real country.

To make this random flag generator tool It has 195 country flags. To us it all you have to do is choose how many you would like to see at a time and click the green generate function.

A picture of the flags and the names of the countries are returned each time.

For each section, include the following:

- a clear introduction on what is being asked for

- possible pro's and con's of AI writers in this section

- how AI writers can be used to solve these problems

- an example of where AI writers have been used successfully.

Here is a tool which helps: [Random Flag Generator](https://codebeautify.org/random-flag-generator)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vo4i9vkh50glky179pzf.png)
 Simply hit the button below to generate flags at random, which are returned with an image.
[Conceito/Desafio] - CPU, Memory, I/O Bound: O que é isso?
Published: 2022-06-04 16:24:45

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

---

Ei dev,

Já ouviu falar que um programa é cpu bound, memory bound, i/o bound, etc.? Não? Então cola aí pra que da próxima vez que você falar com seu crush devops, ele te note.

cc @sseraphini

↓

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

---

O termo "bound" pode soar complexo, mas é simples de entender na verdade. "Bound" pode significar "limite", que pode ser uma boa tradução livre pro nosso contexto.

Dessa forma, "cpu bound" poderia ser traduzido como "limitado pela cpu" e assim por diante, por exemplo.

---

A tradução já explicou boa parte desse conceito. Então, quando dizemos que determinado programa é, por exemplo, memory bound estamos dizendo que sua performance está atrelada/limitada primordialmente à memória disponível. Ou seja, melhoraríamos sua performance com mais memória.

---

O mesmo se aplica para cpu (performance limitada pela cpu), gpu, tamanho do disco, i/o (input/ouput ou entrada/saída), etc.

Aliás, i/o é um termo meio vago que pode significar i/o em disco, rede, periféricos externos, etc. É legal saber sobre isso.

Ah, I/O se pronuncia "Ai-Ou".

---

É meio que isso o conceito. Não falei que era simples?

Se você quiser explorar um pouco mais esse assunto na prática, dá pra facilmente restringir recursos com o docker em relação a memória e cpu com as flags --memory e --cpus.

Dá uma olhada aqui ↓
https://docs.docker.com/config/containers/resource_constraints/

---

Vai lá, escreve algum programa simples e tenta descobrir se ele é memory ou cpu bound.

Se chegou até aqui, não preciso nem dizer, né? Dá um abraço sem love bound aqui ó 🫂 ♥️

Obrigado demais pela moral!
Simple QR - open-source app to scan, create and store QR codes
Tags: showdev, opensource, ionic, angular
Published: 2022-06-04 16:14:50

I've been developing an open-source app called **Simple QR** that provides a simple UI and experience to scan, create and store QR codes. Here is the source code:

{% embed https://github.com/tomfong/simple-qr %}

## What can I do with Simple QR?
By using the app, you can
- Scan and read various barcodes by using camera.
- Import image to read QR code.
- Generate QR code from different templates.
- Customize the QR code, e.g. color, margin, error correction level.
- Do various tasks on the result content with a tap.
- Log the result content from scanning, creating or viewing again.

## What makes Simple QR?
To make it hybrid, I use **ionic, capacitor** and **angular** to develop Simple QR. If you are a beginner of ionic or angular, I think this project is a good reference to you.

## Where can I download from?
Simple QR is available on both [App Store](https://apps.apple.com/us/app/simple-qr-by-tom-fong/id1621121553) and [Google Play](https://play.google.com/store/apps/details?id=com.tomfong.simpleqr).

If you don't want to access to both stores, you can also download it from [GitHub](https://github.com/tomfong/simple-qr/releases/latest) or [IzzyOnDroid](https://apt.izzysoft.de/fdroid/index/apk/com.tomfong.simpleqr).

Any kind of discussion, feedback or idea sharing is welcomed!
Find Nearest Point That Has the Same X or Y Coordinate
Tags: leetcode, dsa, theabbie
Published: 2022-06-04 16:00:45

You are given two integers, `x` and `y`, which represent your current location on a Cartesian grid: `(x, y)`. You are also given an array `points` where each `points[i] = [ai, bi]` represents that a point exists at `(ai, bi)`. A point is **valid** if it shares the same x-coordinate or the same y-coordinate as your location.

Return _the index **(0-indexed)** of the **valid** point with the smallest **Manhattan distance** from your current location_. If there are multiple, return _the valid point with the **smallest** index_. If there are no valid points, return `-1`.

The **Manhattan distance** between two points `(x1, y1)` and `(x2, y2)` is `abs(x1 - x2) + abs(y1 - y2)`.

**Example 1:**

**Input:** x = 3, y = 4, points = \[\[1,2\],\[3,1\],\[2,4\],\[2,3\],\[4,4\]\]
**Output:** 2
**Explanation:** Of all the points, only \[3,1\], \[2,4\] and \[4,4\] are valid. Of the valid points, \[2,4\] and \[4,4\] have the smallest Manhattan distance from your current location, with a distance of 1. \[2,4\] has the smallest index, so return 2.

**Example 2:**

**Input:** x = 3, y = 4, points = \[\[3,4\]\]
**Output:** 0
**Explanation:** The answer is allowed to be on the same location as your current location.

**Example 3:**

**Input:** x = 3, y = 4, points = \[\[2,3\]\]
**Output:** -1
**Explanation:** There are no valid points.

**Constraints:**

*   `1 <= points.length <= 104`
*   `points[i].length == 2`
*   `1 <= x, y, ai, bi <= 104`

**SOLUTION:**

    class Solution:
        def nearestValidPoint(self, x: int, y: int, points: List[List[int]]) -> int:
            n = len(points)
            vals = [i for i in range(n) if points[i][0] == x or points[i][1] == y]
            if len(vals) == 0:
                return -1
            return min(vals, key = lambda j: abs(points[j][0] - x) + abs(points[j][1] - y))
Paracetamol.js💊| #133: Explica este código JavaScript
Tags: javascript, webdev, spanish, programming
Published: 2022-06-04 15:59:58

## **<center>Explica el siguiente código JavaScript</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```js
const fn = function saludo(nombre){
  return `Hola ${nombre}`
}
console.log(fn("Ana"));
console.log(saludo("Pedro"));
```

A. `Hola Ana`, `Hola Pedro` 
B. `Hola Ana`, `Uncaught ReferenceError: saludo is not defined`
C. `Uncaught ReferenceError: fn is not defined`
D. Ninguna de las anteriores

Respuesta en el primer comentario.

---
Trying to learn Golang, any tips ?
Tags: go, programming, discuss, codenewbie
Published: 2022-06-04 15:55:15

Hello world 👋,

So lately I decided to try Golang, As a lazy developer & using Javascript/Typescript for literally everything, I decided to use something new.., I primarily focus on backend development. So after some research I decided to learn Golang.

TBH I have no idea, how to get started & use Golang for my projects.

So how I'm i supposed to use Golang as a backend developer?

![Help me](https://media.giphy.com/media/xxn4b7s3b7eiXRuBjF/giphy.gif)
Websockets in Golang under 5 Minutes.
Tags: go
Published: 2022-06-04 15:49:31

##  Lets start with a simple http endpoint.

Start off by building a simple HTTP server that returns Hello Devs whenever we hit it on port 8001. We’ll also define a simple HTTP endpoint that will act as the base of the WebSocket endpoint that we’ll be creating:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uk0zvht40asp91uc6q7r.png)




## Upgrading the HTTP Connection


To create a WS endpoint we need to upgrade a standard HTTP connection to a WS connection. We'll be using _gorilla/websocket_ package for this.

**1. Define the Upgrader**

This will hold information such as the Read and Write buffer size for our WS connection:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pkj3houxrzrkwn28zcpy.png)


**2. Take care of the CORS**

This will determine whether or not an incoming request from a different domain is allowed to connect, and if it isn’t they’ll be hit with a CORS error. For now, we'll simply return true.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/491rhsdwruk7887mpwir.png)

**3. Upgrading the Connection**

We can now start attempting to upgrade the incoming HTTP connection using the upgrader.Upgrade() function which will take in the Response Writer and the pointer to the HTTP Request and return us with a pointer to a WebSocket connection, or an error if it failed to upgrade.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lyxemp7mr8xz6v4845uw.png)



## Start Listening

Once the client is connected we can pass our WS to a reader function.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s72cfhdjpcx73tmgvt5a.png)

**A simple echo reader: **
A simple reader function that echos back every incoming message: 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rfmzzagjw18yuq2t2l1p.png)


And that's it! We just created a WS endpoint in Go. 

Further reading: 

https://www.freecodecamp.org/news/million-websockets-and-go-cc58418460bb/

Find the code here:
https://gist.github.com/akshanshgusain/f2a797bc593136fd3484edb6d7401c50
Hi Devs, Here is Part 2 of the "This Project Got Me a Full-time Software Engineering Job" Series.💻
Tags: javascript, webdev, programming, 100daysofcode
Published: 2022-06-04 15:32:29


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhm1awwt6hedvvc9dqy7.png)Hi developers, after getting so much feedback about part 1 of my [journey to a full time Software Engineer](https://dev.to/mkasulecoder/this-project-got-me-a-full-time-job-14fk), I just wanted to follow-up with a part 2, potentially a series of how I got my first software job, and how it's currently going. Watch the full series on the links below and feel free to support me as I share, aspire, and motivate other developers through sharing resources that will help them land on their dream job like a did. 

I appreciate the feedback [Demo](https://loopstudiosdemo.netlify.app/
)

Live Stream the Full Build Here: [YouTube Channel](https://youtu.be/UGsRT53hgqM)

Github Follow: [All Source Codes](https://github.com/mkasulecoder)
Find the Difference
Tags: leetcode, dsa, theabbie
Published: 2022-06-04 15:30:38

You are given two strings `s` and `t`.

String `t` is generated by random shuffling string `s` and then add one more letter at a random position.

Return the letter that was added to `t`.

**Example 1:**

**Input:** s = "abcd", t = "abcde"
**Output:** "e"
**Explanation:** 'e' is the letter that was added.

**Example 2:**

**Input:** s = "", t = "y"
**Output:** "y"

**Constraints:**

*   `0 <= s.length <= 1000`
*   `t.length == s.length + 1`
*   `s` and `t` consist of lowercase English letters.

**SOLUTION:**

    class Solution:
        def findTheDifference(self, s: str, t: str) -> str:
            ctr = {}
            for c in t:
                ctr[c] = ctr.get(c, 0) + 1
            for c in s:
                ctr[c] -= 1
                if ctr[c] == 0:
                    del ctr[c]
            return list(ctr)[0]
Nodejs OS Module Cheetsheet
Published: 2022-06-04 15:25:58

Complete Nodejs 🅾🆂 Module Cheetsheet 🔥🔥🔥

The 𝗼𝘀 module provides operating system-related utility methods and properties. It can be accessed using:

```ts
𝗶𝗺𝗽𝗼𝗿𝘁 𝗼𝘀 𝗳𝗿𝗼𝗺 '𝗼𝘀';
```
or
```js
𝗰𝗼𝗻𝘀𝘁 𝗼𝘀 = 𝗿𝗲𝗾𝘂𝗶𝗿𝗲('𝗼𝘀');
```

Below, you can find a comprehensive list of all currently available methods, values and constants exposed by the OS modules.


![nodejs os module cheetsheet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/onvujuh6juo2itjg2iw5.png)

Original Post on LinkedIn(higher quality image): https://www.linkedin.com/posts/activity-6938869751603466240-1cdn/
TIDIO app is mostly used in which country?
Published: 2022-06-04 15:21:38

As per BuiltWith.com data, Tidio is mostly used in US. 
Following are the top 6 countries where Tidio is used:
 - United States

 - United Kingdom

 - Canada

 - Australia

 - India

 - France


![Tidio stats from BuiltWith.com](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wk3bm8rm0tu4w8j6et0i.png)

[https://trends.builtwith.com/widgets/Tidio](https://trends.builtwith.com/widgets/Tidio)

Some of the competitors for Tidio are [Intercom](https://www.intercom.com/), [Kommunicate](https://www.kommunicate.io/) and [Freshchat](https://freshchat.com/)
Running PWA Laravel on Another Devices
Tags: webdev, laravel, pwa, tutorial
Published: 2022-06-04 15:15:37

## PROBLEM DEVELOPING PWA IN LARAVEL
Recently, I developed a laravel apps that implement Progressive Web Apps. After I finish this app, I was curious about How Can I Test this app on another devices like phones or tablets ?!. 

## FINDING SOLUTION
I try to serve development server laravel with custom host that connecting my laptop and my phone. Like `php artisan serve --host someIP --port somePORT`, but it doesn't work lol. I can visit my web app but I don't know why the service worker didn't want to be loaded. I assumed it just because SSL problem.

Then I start googling again how to serve laravel development server with SSL/https ?!?!. Many of articles and SOF suggest me to make virtual host with nginx or ngrok. I searched it but I can't follow the steps it's pretty hard for me to follow.

## SOLUTION
After few days I search it on google and I found a solution to solve this problem with port forwarding. Yep it's simple. Just follow step below

1. First you have to start your laravel project with normal command `php artisan serve`.
2. Prepare your phone (cause I am using phone) with developer option is on and make sure usb debugging is on too. Shortly Make sure your phone in debug mode.
3. After that, connect your phone with usb cable to your laptop/PC.
4. After your devices connected to each other, just visit this chrome://inspect#devices
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/panix6d3oeemd8rg3j4l.png)
5. Then, choose port forwarding.
6. Insert your localhost and it's port.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c7dm0b4jep6xqc9ghrfg.png) 
7. Make sure check enable port forwarding. Then, Click Done.
8. At Last, visit localhost with port using your phone. 

And it will load your service worker as well. Cheerss !!!!. If you find this solution difficult to understand, feel free to ask in comment below.