teleren/devto huggingface dataset:
The "last mile" of functional-reactive web development
Tags: webdev, javascript, rxjs, rimmel
Published: 2024-02-22 14:30:00

Telecommunication services have historically been made difficult by the last mile problem: the physical cables reaching subscribers' premises, difficult and expensive to connect, manage, upgrade and maintain.

Functional-reactive programming has been suffering a similar issue when dealing with HTML pages and templates.

When you create an application's logic, it's relatively easy to define a number of pure functions, their inputs and their outputs.

Sinking results to the DOM can't be done in a functional way, because HTML+JavaScript are not completely functional, so imperative code is needed.

```js
const data = new Observable(observer => {
   setInterval(observer.next(getData()), 1000)
});

data.subsscribe(newData =>
 targetElement.innerHTML = newData
);
```

What if there was, in fact, a way to use a functional programming style to achieve the same thing?

Turns out there is. A little library called [Rimmel.js](https://rimmel.js.org) comes with first-class support for Observables, Observers, Promises, and all you need to keep a proper functional programming style.

```js
const data = new Observable(observer => {
   setInterval(observer.next(getData()), 1000)
});

document.body.innerHTML = rml`
  <div>${data}</div>
`;
```

In this example, we changed our approach from a "push" model, to a "pull" model. The template itself is pulling data from an observable stream, which we can leave as a pure function, and there is no imperative code for us to write in order to update the DOM. That part is done by Rimmel, which reccognises the observable and diligently sets up subscriptions and unsubscriptions behind the scenes for us.

No more explicitly setting of `innerHTML`, `style`, `dataset`, `disabled`, or other HTML attributes. Simply define variables, promises or observables, put them in your templates, and Rimmel will do all the binding.

The context tells how data needs binding.

```js
  const template = rml`
    <div class="${anObservableThatEmitsClasses}"></div>
  `;
```

This allows you to neatly separate data from presentation. Thanks to the purely-functional style of your code, it will be much simpler to test them in isolation without excessive relyance on mocks and stubs.

## QA
Interested in testing? LeapingBunny is a library designed to test observable view-models using ASCII-art. That means even really complex unit tests take 2 lines of code [LeapingBunny](https://github.com/hellomenu/leaping-bunny)
Como instalar o Storybook em um projeto Vue + Webpack
Tags: storybook, vue, webpack
Published: 2024-02-22 14:29:54

O [Storybook](https://storybook.js.org) por padrão agora instala suas configurações padrões baseado no [Vite](https://vitejs.dev), porém se já tem um projeto que já utiliza o [Webpack](https://webpack.js.org), ele não vai funcionar.

Para configurar o Storybook então, precisa definir qual é o builder do projeto usando o parâmetro `--builder webpack5`.

Basta rodar o código abaixo para adicionar ao seu projeto:
```
npx storybook@latest init --builder webpack5
```

Ele adicionará um diretório `stories` com arquivos de exemplo que pode usar para se guiar em como criar as documentações ou excluir caso não vá usar.

Importante configurar no arquivo `.storybook/main.js` o local e formato dos arquivos de docmentação que você usará no seu projeto:

```
  stories: [
    "../stories/**/*.mdx",
    "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
  ],
```

**Nota:**
O NPM 7+ instala _peerDependecies_ por padrão, mas se isso for um problema para o seu projeto, adicione também o parâmetro `--legacy-peer-deps`.

```
npx --legacy-peer-deps storybook@latest init --builder webpack5
```

.

_Solução encontrada nessa [issue](https://github.com/storybookjs/storybook/issues/22194#issuecomment-1613762210)_
Go: The Fundamentals - Pointer
Tags: go, backend, backenddevelopment, fundamenta
Published: 2024-02-22 14:23:18


Pointer เป็น Concept พื้นฐานในงาน Computer Science และมีอยู่ในหลาย Programming Language, ซึ่งใน Go มีคุณสมบัตินี้อยู่. Pointer เป็นตัวแปรที่จัดเก็บไว้บน Memory address ของตัวแปรทั้งหมด. ซึ่งจะช่วยให้เราจัดการกับ Memory ได้โดยตรงหรือทำการอ้างอิงถึงตัวแปรนั้นๆได้. เราจะสังเกตุได้ว่าตัวแปรไหนเป็น pointer โดยตัวแปรนั้นจะมีสัญลักษณ์ * ประกอบอยู่ด้วยในตอนประกาศตัวแปรหรือตอนใช้งาน

ตัวอย่าง: 

```
// n := 2
// double(&n)
// n == 4
func double(n *int) {
	*n = *n + 2
}

// name := "Bob"
// appendGreeting(&name)
// name == "Hi, Bob"
func appendGreeting(s *string) {
	*s = "Hi, " + *s
}
```

ต่อมาจะขอยกตัวอย่างการใช้งาน pointer จาก func ตัวอย่างด้านบน

```
import "fmt"

func main() {
      n := 2
      double(&n)
      fmt.Println(n)
      // 4
      name := "Bob"
      appendGreeting(&name)
      fmt.Println(name) 
      // Hi, Bob
}

func double(n *int) {
	*n = *n + 2
}

func appendGreeting(s *string) {
	*s = "Hi, " + *s
}
```
อธิบายเพิ่มเติม จาก code ด้านบนจะประกอบไปด้วย 3 function
1. func main คือ ตัวที่ทำการ run และ implement function ต่างๆจากตัวอย่างด้านมาใช้งาน โดยมีการ สร้างตัวแปรพร้อม assign value และส่งไปเป็น Parameter ของ function ตัวอย่าง

2. func double(n *int) จะทำหน้าที่เปลี่ยนแปลงค่า pointer ที่ส่งมากับ parameter n *int โดยมีการคำนวณและ assign. ค่ากลับไปให้ตัวแปร pointer
3. func appendGreeting(s *string) จะทำงานเหมือนข้อ 2 ที่กล่าวมาแตกต่างตรงที่เป็นตัวแปร type string 

Developer ท่านไหนกำลังสนใจ Go สามารถนำไปศึกษาเพิ่มเติมต่อได้ครับ หวังจะเป็นประโยชน์กับหลายๆคนนะครับ

Source Code : [https://github.com/header-dev/go-fundam.git](https://github.com/header-dev/go-fundam.git)
Has anyone else noticed an increase in New, Empty Profile Followers recently?
Tags: discuss, community
Published: 2024-02-22 14:05:41

I've been noticing something a bit unusual over the past few days and I'm curious if anyone else has experienced the same. A significant number of new followers have been added to my profile, however, upon closer inspection, I realized that many of these accounts are newly created with no information at all - no posts, comments, or any form of engagement.

This trend has left me feeling a bit puzzled and, honestly, a bit discouraged. It's made me question the authenticity of the engagement on this platform. Are these real people interested in my content, or is there something else at play here?
The Best Website Designing Company In Ambala
Tags: webdev, webdesign
Published: 2024-02-22 14:02:54

Crafting amazing online experiences takes skill! With web design you can bring ideas to life through creative layouts, eye-catching graphics, and slick interfaces. Transform simple text and images into an interactive masterpiece with the power of HTML, CSS, and other coding languages. Pull visitors in with striking visuals then engage them with intuitive navigation. Plan aesthetics and functionality hand-in-hand - good design is usable. Bring your website vision into focus with testing across devices. Launch your sleek site ready to make a stunning first impression.

In today's digital world, your website is your storefront - make sure it leaves a lasting impression! 
TEEMERS is your go-to partner for captivating web design that turbocharges your online presence. Their talented team brings ideas to life with stunning graphics, seamless UI, and intuitive navigation so your customers enjoy an effortless experience. But they don't just make things pretty. TEEMERS leverages hard-hitting marketing strategies to drive real results. Their technical prowess in SEO, PPC, and analytics means your brand is visible and converting. TEEMERS can custom-craft a website that becomes a magnet for qualified traffic. With an obsession for customer satisfaction, they'll work tirelessly to optimize conversion at every step. Don't settle for an average website. Partner with the passionate pros at TEEMERS to unlock your digital potential today! With strategic solutions that blend creativity and technology, they design and develop sites that help brands thrive online. Reach your goals with TEEMERS!

For more info, visit our website : https://teemers.in/
GetBlock’s Team Gears Up for an Inspiring Journey at ETH Denver Conference
Tags: ethereum, etherjs, discuss, blockchain
Published: 2024-02-22 13:47:36

The [GetBlock](https://getblock.io/) team is excited to announce our participation in the upcoming [ETH Denver conference](https://www.ethdenver.com/), a cornerstone event for the Ethereum and blockchain community. Our commitment to driving innovation and facilitating seamless blockchain integration aligns perfectly with the spirit of ETH Denver, making this an event we eagerly anticipate.

ETH Denver stands out as a beacon for blockchain professionals, developers, and enthusiasts, offering a rich environment for collaboration, learning, and exploration of the latest in Ethereum and decentralized technology. The conference’s community-centric ethos resonates with our own values at GetBlock, where we strive to support and enhance the blockchain ecosystem.

Our team is looking forward to connecting with the vibrant community at ETH Denver. We’re passionate about making blockchain more accessible and are eager to share our insights and solutions with fellow innovators at the conference.

As participants, we at GetBlock are excited to demonstrate our cutting-edge node provision services and API, designed to simplify blockchain integration for developers and businesses. Our presence at ETH Denver is an opportunity for us to engage with the community, understand their needs, and discuss how our services can support the development of groundbreaking decentralized applications.

ETH Denver is more than just a conference; it’s a catalyst for growth, innovation, and collaboration within the blockchain sector. Our involvement signifies GetBlock’s dedication to contributing to this dynamic ecosystem. We are enthusiastic about the conversations, ideas, and partnerships that will emerge from this gathering of industry leaders and visionaries.

The GetBlock team is gearing up for an inspiring experience at ETH Denver. We are poised to share our expertise, learn from others, and play an active role in shaping the future of blockchain technology. The conference promises to be a pivotal moment for both GetBlock and the wider blockchain community, and we can’t wait to be a part of it.
Mastering React State Management with useReducer: A Comprehensive Guide
Tags: react, webdev, javascript, usereducer
Published: 2024-02-22 13:41:35


**Introduction:**
Hey DEV community! 👋 In this tutorial, we'll delve into the versatile `useReducer` hook in React and explore its capabilities in managing multiple states within a functional component. Today, we'll build a robust user management system with states for `userId`, `userType`, and `userName`. Let's get started!

---

**1. Setting Up the React App:**
Begin by creating a new React app using Create React App. Navigate to your project directory and run:

```bash
npx create-react-app use-reducer-tutorial
cd use-reducer-tutorial
```

---

**2. Create a Reducer:**
Inside the `src` folder, create a file named `userReducer.js`. Define the reducer to handle user-related states:

```jsx
// src/userReducer.js
const userReducer = (state, action) => {
  switch (action.type) {
    case 'SET_USER':
      return {
        ...state,
        userId: action.payload.userId,
        userType: action.payload.userType,
        userName: action.payload.userName,
      };
    default:
      return state;
  }
};

export default userReducer;
```

---

**3. Create the User Component:**
In the `src` folder, create a file named `User.js`. Use `useReducer` to manage user-related states:

```jsx
// src/User.js
import React, { useReducer } from 'react';
import userReducer from './userReducer';

const User = () => {
  const initialState = { userId: null, userType: null, userName: null };
  const [state, dispatch] = useReducer(userReducer, initialState);

  const setUser = () => {
    dispatch({
      type: 'SET_USER',
      payload: {
        userId: '123',
        userType: 'admin',
        userName: 'John Doe',
      },
    });
  };

  return (
    <div>
      <h1>User Information:</h1>
      <p>User ID: {state.userId}</p>
      <p>User Type: {state.userType}</p>
      <p>User Name: {state.userName}</p>
      <button onClick={setUser}>Set User</button>
    </div>
  );
};

export default User;
```

---

**4. Use the User Component in App.js:**
Replace the content of `src/App.js` with the following:

```jsx
// src/App.js
import React from 'react';
import User from './User';

function App() {
  return (
    <div className="App">
      <User />
    </div>
  );
}

export default App;
```

---

**5. Run the Application:**
Start your React app:

```bash
npm start
```

Open your browser and go to `http://localhost:3000` to see the user management system in action.

---

**Conclusion:**
In this tutorial, we've harnessed the power of `useReducer` to manage multiple states (`userId`, `userType`, `userName`) efficiently. The `userReducer` handles the logic, and the `User` component uses `useReducer` to manage and update user-related states. Feel free to adapt this example to more complex scenarios and elevate your React state management game!

---

**Have you explored `useReducer` in your projects? Share your experiences below! Let's learn and grow together.**

---

**#React #StateManagement #useReducer #JavaScript #WebDev**
Are programming and coding the same thing?
Published: 2024-02-22 13:35:54

In everyday speech, the terms "programming" and "coding" are frequently used interchangeably, however their meanings might vary slightly according on the situation. A summary is provided below:

1. Programming - Programming is the more general process of writing a set of instructions (or code) that instructs a computer on how to carry out a given function or resolve an issue.

   It include creating :
 
algorithms, outlining a program's logic, organizing data, and putting solutions into practice using a programming language.

   "- Problem-solving, designing algorithms, testing, debugging, and software architecture are all included in programming.

2. Coding: - Coding is a subset of programming in which the actual lines of code needed to implement a solution are written 
in a programming language.


   "- It focuses on converting the syntax, commands, and constructions of a programming language into the logic and algorithms of a program.


   "- Writing, revising, and repairing code are all part of the coding process. Code must also be arranged into modules and functions.


To summarize, the process of designing and developing software solutions is known as programming, whereas the act of writing the code necessary to make those solutions function is known as coding. 

Consider the process of addressing problems all the way through to implementation when you think of programming, and consider coding as the actual work where you write the lines of code. 


Despite their close relationship and frequent interchangeability, these phrases have different meanings when taken into consideration.
Documenta seu PR/MR, criatura- PR's template
Tags: git, pullrequest, programming
Published: 2024-02-22 13:33:57



![Print de um mr com 128 alterações sem nenhuma descrição](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ou57kubz5qn5gyoshfrq.png)


![Aí meu deus, ainda é quarta-feira](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bogqtum92cou98owafga.png)


Quem nunca viu ou abriu um PR/MR sem descrição, né!? :poop:

Agora vamos passar disso aí pra isso aqui:

![PR com descrição](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8qha6cs8qb3p617nzute.png)

## Como que faço isso? 
Simples, simples, simples. 

#### Github:
- Add na raiz do seu projeto um arquivo markdown com esse nome `pull_request_template.md` e taca na main.
- Insere lá esse [markdown](https://github.com/coderanac/template-pr/blob/main/pull_request_template.md) aqui e prontinho.
- No seu próximo PR ela já aperce automágicamente.

#### Gitlab:

- Add no seu projeto um arquivo markdown com esse nome `.gitlab/pull_request_template.md` e taca na main.
- Insere lá esse [markdown](https://github.com/coderanac/template-pr/blob/main/pull_request_template.md) aqui e prontinho.
- Na hora de abrir um MR é só escolher o template na descrição:

![Campo select de um template em descrição](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uf90gi7ikfg5pdcfnwc4.png)



> Pra que cê vai gastar mais tempo meu?


![Bob esponja bobo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/brov24ewbufp3n4c6ohe.gif)

#### Documentação
Pra ter registrado de forma legível para devs e não devs o que foi feito, quando, como, porquê. Isso na hora de demonstrar seu trabalho com sua liderança é ótimo.

#### Evitar retrabalho
Devs tem que entender código, mas saber porquê você fez as alterações e uma breve explicação das lógicas vai economizar tempo com dúvidas e ajudar num code review menos cansativo. Pegar melhorias na etapa de code review é muito melhor que pegar com pressão do seu tech lead ou PO.


Use, adapte ao seu cenário e seja feliz. E pra deixar ainda mais lindo e de fácil rastreio eu indico DEMAIS esse cara aqui: https://gitmoji.dev/


![simpson feliz, é sexta feita](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4nn3n26ioyon7tnqczbc.gif)
How to control python package versions?
Tags: discuss, help, python, softwaredevelopment
Published: 2024-02-22 13:32:20

Guys, I have a question, how can you control the versions of Python packages for different Python versions in software development at work?

Example:

I have the following packages

VersionPython 3.8
A==1.1.2
B==2.3.1

I have software using these packages.

But I need to use this software for Python 3.10, but package A is not compatible with this version of Python 3.10, because it was updated to version A==2.3.1, it is causing incompatibility with version 3.8.

What would be the ways and tools to be able to test and verify the compatibility of versions, without having to affect the software's functionalities?
Kakek Zeus
Published: 2024-02-22 13:27:36


Tidak dapat dipungkiri bahwa website poker yang tawarkan banyak bonus merupakan salah satu perihal yang senantiasa dicari oleh banyak pemain. Untuk beroleh sebagian bonus, Anda cuma harus lakukan lebih dari satu perihal saja, tidak benar satunya adalah bersama mendaftar sebagai bagian baru pada web tersebut. Anda bisa jadi bermain bersama dengan menentukan web site poker yang mempunyai reputasi baik dan sudah pasti amat terpercaya. Anda sanggup mendapatkan beragam website poker di web liburpoker. Dengan mendaftar di web site liburpoker, Anda dapat segera disambut bersama bonus yang terlalu menarik. Bonus tersebut diberikan didalam bermacam type dan variasi yang berbeda-beda. Untuk mendapatkannya, Anda mesti laksanakan sebagian hal. Apa saja model bonusnya? Yuk simak pembahasannya di bawah ini untuk mendapatkan informasi penting. [http://voccoquan.com/](http://voccoquan.com/)
Markdown to HTML Converter - SopKit
Published: 2024-02-22 13:26:45

# Creating a Markdown to HTML Converter

> https://sopkit.github.io/markdown-to-html-converter/


We will Use the JavaScript Library - Showdown

{% codepen https://codepen.io/SH20RAJ/pen/oNVRywP %}



```html

<!DOCTYPE html>
<html>
<head>
    <title>Markdown to HTML Converter</title>
    <link rel="stylesheet" type="text/css" href="styles.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"></script>
</head>
<body>
    <div class="container">
        <h2>Markdown to HTML Converter</h2>
        <textarea id="inputText" rows="10" cols="50" placeholder="Enter Markdown text"></textarea><br>
        <button onclick="convertToHtml()">Convert to HTML</button>
        <button onclick="convertToMarkdown()">Convert to Markdown</button><br><br>

        <div class="result-container">
            <div class="code-container">
                <h3>HTML Code</h3>
                <button onclick="copyHtmlCode()">Copy HTML</button>
                <textarea id="htmlCode" rows="10" cols="50" readonly></textarea>
            </div>
            <div class="parsed-container">
                <h3>Parsed HTML</h3>
                <button onclick="copyParsedHtml()">Copy Parsed HTML</button>
                <div id="parsedHtml"></div>
            </div>
        </div>
    </div>

    <script>
        function convertToHtml() {
            var markdownText = document.getElementById('inputText').value;
            var converter = new showdown.Converter();
            var htmlText = converter.makeHtml(markdownText);
            document.getElementById('htmlCode').value = htmlText;
            document.getElementById('parsedHtml').innerHTML = htmlText;
        }

        function convertToMarkdown() {
            var htmlText = document.getElementById('inputText').value;
            var converter = new showdown.Converter({ simpleLineBreaks: true });
            var markdownText = converter.makeMarkdown(htmlText);
            document.getElementById('htmlCode').value = htmlText;
            document.getElementById('parsedHtml').innerHTML = markdownText;
        }

        function copyHtmlCode() {
            var htmlCode = document.getElementById('htmlCode');
            htmlCode.select();
            document.execCommand('copy');
            alert('HTML code copied to clipboard');
        }

        function copyParsedHtml() {
            var parsedHtml = document.getElementById('parsedHtml');
            var range = document.createRange();
            range.selectNode(parsedHtml);
            window.getSelection().removeAllRanges();
            window.getSelection().addRange(range);
            document.execCommand('copy');
            window.getSelection().removeAllRanges();
            alert('Parsed HTML copied to clipboard');
        }
    </script>
</body>
</html>

        }
    </script>
</body>
</html>

```