teleren/devto huggingface dataset:
Interested in the social impact you can have as a developer? Read this post.
Tags: meta, forem, inclusion, socialimpact
Published: 2022-04-13 18:30:06

---

series: Forem Community Highlights

---



Today, I’m excited to highlight a Forem that has a ton of relevance for everyone on DEV:  the **[Development Hackers Community](https://www.developmenthackers.com/)** 🎉

Development Hackers’ founder, @askrayan, said this about why he started this new community:

> #### “_At some point, I ended up being in 20 different niche “Tech for Good” communities and I couldn’t make much sense of them. They were all too local: centered on one organization, in one particular country or city, and ultra-specific technologies. On top of that, they were all private Slack, Discord or LinkedIn groups, so you couldn’t even find the discussions on a search engine.”_


As you can see, Development Hacker’s mission of transparency and community goodwill in tech is very much in-line with [our own](https://www.forem.com/about) at Forem. We’re thrilled to have them as part of our ecosystem. One example of how they’re committed to their mission is their current focus on how programmers can help the people of Ukraine. Read more about this [here](https://www.developmenthackers.com/ukraine/help-victims-of-the-war-in-ukraine--4c3m).  Development Hackers is currently promoting ways that programmers can help people from Ukraine.

## **[Check out Development Hackers now!](https://www.developmenthackers.com/)**

_We strongly encourage you to [sign up](https://www.developmenthackers.com/enter) and keep up with opportunities for impact!_

***

**A few final notes:**

I turned my recent Forem community highlights into a series – take a look at the other communities I’ve shed some light on over the past few weeks! While DEV remains a fantastic and truly global space to connect with other devs, share your knowledge on a variety of topics, and learn, [Forem](https://www.forem.com/)’s goal is to make the internet _smaller_ and driven by community leaders directly.  We believe that this can only be accomplished by tightening the focus of online communities and the Forems in this series are great places to go deep on specific topics.

You’ll notice **"Sign up with Forem"** as an option alongside GitHub and email. This is a service we now offer to most seamlessly navigate the ecosystem and manage your identity. We want you to be able to bring your full self without having to bring your full data, so making this distributed ecosystem as straightforward as possible in the long run is really important. Create a [Forem account](https://account.forem.com/) and connect it with your DEV account [via your settings](https://dev.to/settings). 🙂


***

**Happy impactful coding!**
A Simple API for Web3 Data
Published: 2022-04-13 18:28:25

It should be easy to query Web3 data, all of it, anything on the blockchain. Despite the blockchain's openness, it's still extremely hard to decode and use blockchain data.

## Introducing a Simple API for Web3 Data

Today we're releasing the Alpha version of a new [API for accessing data on the Ethereum blockchain](https://docs.sort.xyz). 

1. Access a fully decoded transaction including logs and function information

```
GET https://api.sort.xyz/v0/transaction/0x4a4101abb79d0e6d8d09dac5f1d2312ef713f20b1101eefcd395a040985eda28
```

2. Access the latest transactions for a contract address

```
POST https://api.sort.xyz/v0/transaction/
{
  "contract_address" : "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
  "limit": 10
}
```

3. Access NFT data for a contract

```
POST https://api.sort.xyz/v0/transaction/
{
  "nft_address" : "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
  "nft_event" : "sale",
  "limit": 10
}
```

4. Aggregate coin sales data to power a real-time sales chart

```
POST https://api.sort.xyz/v0/transaction/
{
  "contract_address" : "0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f",
  "coin_buy" : "0x0ab87046fBb341D058F17CBC4c1133F25a20a52f",
  "aggregate" : { "op" : "sum", "by" : "hour", "field" : "coin_transaction.from.amount_shifted" },
  "limit" : 24,
  "timestamp" : "gte:2021-03-22"
}
```

## An Open API

The Sort Analytics API is free, [rate limits and other information are listed here](https://docs.sort.xyz/api-docs/api-limits).

As of April 13, 2022, the API is considered version 0 (Public Alpha), we are still finding and fixing occasional bugs. Please relay any feedback to the team via our [public discord](https://discord.gg/Q9Z8Pan9).

## Powering Dashboards, Applications, Charts, and More

Use the API to power anything in your application that needs Web3 data. Since the API is open and doesn't require API keys, no server side code is needed, all API calls can be made directly by the client.

## Continue by 

- Exploring the [API Docs (docs.sort.xyz)](https://docs.sort.xyz)
- View a [tutorial on building a CryptoPunks V1 analytics dashboard](https://dev.to/sort_xyz/tutorial-adding-analytics-to-the-cryptopunks-v1-site-4ad0)
Blaze 2.6 released! 🔥
Tags: meteor, blaze
Published: 2022-04-13 18:23:25

Blaze, front-end library for [Meteor](https://www.meteor.com), has just released version 2.6! This is a feature release which  will be most noticeable for removal of deprecated APIs from before Meteor 1.0 release when Blaze was tightly integrated with Meteor. This sort of mirrors efforts from around Meteor 2.3. This should affect only super old packages, so if you get issues with this, you should really think about ditching or replacing those packages.

On a similar note `underscore` has been removed from `observe-sequence` package, which should be pretty much all of remaining underscore in Blaze. This is an ongoing effort to lighten up the packages.

On noticable new features we have support for arbitrary itterables in `#each` templates.

All of that being said, work has already started on [Blaze 3.0](https://github.com/meteor/blaze/pulls?q=is%3Aopen+is%3Apr+milestone%3A%22Blaze+3.0%22), so stay tuned for this major release!

You can get the latest Blaze by just running `meteor update`.

## Full changelog for Blaze 2.6

* [#330](https://github.com/meteor/blaze/pull/330) Removed deprecated APIs from before Meteor 1.0
  * This is potentially breaking, especially for old packages and apps.
  * `blaze-html-templates@2.0.0`
    * Dependency on `ui` and `spacebars` package has been removed
  * `spacebars@1.3.0`
    * `Spacebars.TemplateWith` has been removed, please use `Blaze._TemplateWith` if you need it.
  * `blaze@2.6.0`
    * `Blaze.InOuterTemplateScope` has been removed, if you need it, you can use `Blaze._InOuterTemplateScope`
  * `templating-runtime@1.6.0`
    * `Template.__define__` has been removed
    * `UI.body` has been removed, you should be using `Template.body`
    * `Template.__body__` has been removed, you should be using `Template.body`
    * `Template.__body__.__contentParts` has been removed, you should be using `Template.body.contentViews`
    * `Template.__body__.__instantiate` has been removed, you should be using `Template.body.renderToDocument`
* [#341](https://github.com/meteor/blaze/pull/341) Add support for arbitrary iterables in #each templates
* [#358](https://github.com/meteor/blaze/pull/358) Make Template.contentBlock consistent with/out data provided
* [#359](https://github.com/meteor/blaze/pull/359) Underscore has been removed from observe sequence
* Updated testing dependencies


--------
If you like my work, please support me on [GitHub Sponsors ❤️](https://github.com/sponsors/StorytellerCZ).
Debug React
Published: 2022-04-13 18:02:45

I have to debug a website built with React (16.12.0 per the package.json file).

When the Customer clicks "Next" in the process, the next page loads with the bottom of the page shown instead of the top.

The problem is that there is no React.js page that is loaded. I'm still on the same page and the URL hasn't changed, so I can't step through the OnLoad event.

I set a breakpoint on the mouse click() event in Chrome, but it ends with a call to an anonymous "await function" that I cannot find where it is created.

Work told me to watch some training videos on React.js, but those are too basic.

Does anyone know what I could look for?
A more stylish way to write conditional Tailwind classes
Tags: react, tailwindcss
Published: 2022-04-13 17:36:46

TLDR; Instead of writting like this:
```javascript
className={clsx(
  'rounded px-2 py-1',
  variant == 'contained' && 'bg-blue-500 text-white',
  variant == 'outlined' && 'border border-blue-500 text-blue-500'
)}
```
Prefer this:
```javascript
className={clsx(
  'rounded px-2 py-1',
  variantStyle[variant], className
)}
```

Full implementation:
```javascript
import clsx from 'clsx'
import { ButtonHTMLAttributes, FC } from 'react'

type Variants = 'outlined' | 'contained'

type ButtonProps = {
  variant: Variants
} & ButtonHTMLAttributes<HTMLButtonElement>

const variantStyle: { [key in Variants]: string } = {
  contained: 'bg-blue-500 text-white',
  outlined: 'border border-blue-500 text-blue-500',
}

const Button: FC<ButtonProps> = (props) => {
  const { children, variant, className, ...rest } = props
  return (
    <button
      className={clsx('rounded px-2 py-1', variantStyle[variant], className)}
      {...rest}
    >
      {children}
    </button>
  )
}

export default Button
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kwz6exze0mptob42ql7.png)
Javascript console.time(), What is it?
Tags: javascript, webdev, programming, tutorial
Published: 2022-04-13 17:30:23

![console.time()](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9kkgef50y61v8qetc60b.png)
 

---


> The console.time() method starts a timer you can use to track how long an operation takes. You give each timer a unique name, and may have up to 10,000 timers running on a given page. When you call console.timeEnd() with the same name, the browser will output the time, in milliseconds, that elapsed since the timer was started. MDN

**Syntax :**
we first define our timer with console.time and then write the code we need to measure how long it takes to execute and lastly we stop the timer and log the time with `console.timeEnd()`

![console.time() syntax](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hn6niov7iv6hr9p4ckzd.png)

---

 
you can use `console.time()` to measure how long any task in your code will take to run, so it’s useful what tasks takes long time and then you split the logic of this task into smaller tasks to improve your code performance, since javascript is single-threaded language, any task that take a lot of time will effect your site or application performance badly or even make it not interactive for seconds which is the worst thing may happen.

---


Thanks for reading, and feel free to ask any question about javascript or about this series and i appreciate any feedback to improve My content.
find me on [twitter](https://twitter.com/Osam1010), [github](https://github.com/osama865/) and [my portfolio](http://o-portfolio.netlify.com/).
Releasing my first iOS app.
Tags: swift, ios, mobile, beginners
Published: 2022-04-13 17:28:54

On April 4th, I released my first ever app to the app store. I started my iOS dev journey early 2020. I have created many apps since then but never released one until now.

Although the app that I decided to release is nothing spectacular or 'unique', nothing matches the feeling of seeing your app get accepted onto the Apple Appstore and knowing it's out there and can be downloaded by anyone.. It felt like I won the lottery.

Notie, is a simple note taking app that you can use everyday to make quick and easy notes without any hassle. Currently Notie stores data on the users device but in the coming months I plan to implement CloudKit to allow the data to sync across all the users apple devices.

As I write this my app has been downloaded in 6 countries , has a five start rating and is used by many day to day. I am pleased with those stats and hope to see them rise in the future. 

If you would like to view and download the app here is the app store link: [Notie](https://apps.apple.com/gb/app/notie/id1617517158)

I will be posting my indie mobile app developer journey along with tips, my project progress and other developer related content on my future posts.

Thank you for taking the time to read this.
Happy Coding!
Implement Socialite for Laravel Jetstream.
Tags: laravel, jetstream, socialite, php
Published: 2022-04-13 17:26:30

Hello everyone

I've been created a php package that helps you to  replace the published authentication and profile scaffolding provided by Laravel Jetstream, with scaffolding that has support for Laravel Socialite.

It is like Jetstream, should only be installed on NEW applications.

for more information and usage you should visit the
[repo](https://github.com/tal7aouy/larastream
)


![Larastream](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1n4d65xchi5u134i11wc.png)
Golang Working With Files...
Tags: go, cli, beginners
Published: 2022-04-13 17:23:31

Today a short one again. I have played around with some go again and wanted to write it down. There are multiple options to some of the stuff i did. So this is not a comprehensive guide. 

**Check if file exists**
```go 
func fileExists(fileName string) (bool, error) {
	info, err := os.Stat(fileName)
	if err != nil {
		if os.IsNotExist(err) {
			return false, nil
		} else {
			return false, err
		}
	}
	return !info.IsDir(), nil
}
```

**Create a file and write text to it**

```go 
created, err = os.Create("test.txt")
if err != nil {
	log.Fatal(err)
}

//write to text file
//i ignore the number of bytes writen here
_, err = created.WriteString("Hello World")
if err != nil {
	log.Fatal(err)
}

//Close the file so it can be used later
created.Close()
``` 

Learned a lesson here. In my first version i wrote defer created.close(). But than later ran into problems, when i wanted to read from the file. So you need to close the file if you want to read from it in the same function. 

**Delete a file**

```go
created, err = os.Create("toDelete.txt")
if err != nil {
   log.Fatal(err)
}
created.Close()

err := os.Remove("toDelete.txt")
if err != nil {
   log.Fatal(e)
}

```


**Read from a text file - 1**

```go
anotherFile, err := os.Open("anotherFile.txt")
if err != nil {
	log.Fatal(err)
}
scanner := bufio.NewScanner(anotherFile)
for scanner.Scan() {
	fmt.Println(scanner.Text())
}

if err := scanner.Err(); err != nil {
	log.Fatal(err)
}
```

**Read from a text file - 2**

```go
content, err := os.ReadFile(fileName)

if err != nil {
	log.Fatal(err)
}
//The content is a []byte because of that: string(...)
fmt.Println(string(content))
}
```



Not much to adress here. I slowy see the verbosity of go. Haven't made up my mind about the language yet. 

**Copy or move a file**

```go 
//copy a file
bytesRead, err := ioutil.ReadFile("fileToCopy.txt")
if err != nil {
	log.Fatal(err)
}
ioutil.WriteFile("cptrgt/CopyTarget.txt", bytesRead, os.ModePerm)

//Move a file
err = os.Rename("oldFile.txt", "cptrgt/newFile.txt")
if err != nil {
	log.Fatal(err)
}
```

Don't like how to move a file. Not a catastrophe but also not really intuitive either. Have not tested the copy speeds yet. 

**Create and recursivly delete a Folder**

```go
//create a new Folder
if err := os.Mkdir("cptrgt", os.ModePerm); err != nil {
	log.Fatal(err)
}

//delete a folder recursively
err := os.RemoveAll("cptrgt")
if err != nil {
	log.Fatal(err)
}
```
After my last post i was happy a about the syntax but now i stumble more and mor about how verbose it is. Honestly i would say i'm not sold on go for quick commandline tools. I see the great performance and simple deployment, but at the moment i wouldn't trade it for python, java or the powershell. But i will keep learning and maybe i will be convinced.
Hibernate - EAGER fetching
Tags: hibernate, database, programming
Published: 2022-04-13 17:14:36

EAGER fetching tells Hibernate to get the related entities with the initial query. This can be very efficient because all entities are fetched with only one query. But in most cases it just creates a huge overhead because you select entities you don't need in your use case. 

Here is an example why you may not need **EAGER** as fetching type. A basic class tells that an EagerCompany has multiple EagerProducts. The default FetchType is LAZY. However, the coder overwrite the fetch type as EAGER.


```java
@Entity
@Table(name='companies')
public class EagerCompany { 
  @Id
  private int id;
  private String name;

  @OneToMany(fetch = FetchType.EAGER, mappedBy = 'company')
  private Set<EagerProducts> products = new HashSet<>();
}
```

To observe what is running on the background, coder has implemented a basic method.

```java
@Transactional
public int countProductsByCompany(int id) {
  EagerCompany company = entityManager.find(EagerCompany.class, id);
  return company.getProducts().size();
}
```
The output of Hibernate query is:

`Hibernate: 
select eagercompa0_.id as id1_0_0_, 
       eagercompa0_.name as name2_0_0_, 
       products1_.company_id as company_3_1_1_, 
       productsl_.id as id1_1_1_, 
       productsl_.id as id1_1_2_, 
       products1_.company_id as company_3_1_2_, 
       products1_.stock as stock2_1_2_ 
from 
       companies eagercompa0_
left outer join 
       products products1_
on
       eagercompa0_.id = products1_.company_id
where
       eagercompa0_.id=?
`

> In **eager** loading strategy, if we load the **Company** data, it will also load up all **Products** associated with it and will store it in a memory.

The EAGER product association was retrieved using an left join. All the relative associations fetched as well. For M such associations the owner entity table is going to be joined M times.

Each extra join adds up to the overall query complexity and execution time. If we don’t even use all these associations, for every possible business scenario, then we’ve just paid the extra performance penalty for nothing in return.

## To sum up,

Advantages:

- No delayed initialization-related performance impacts

Disadvantages:

- Long initial loading time
- Loading too much unnecessary data might impact performance
Grow traffic to your GitHub profile w/ GitHub Actions
Tags: github, community, analytics, githubactions
Published: 2022-04-13 17:06:09

The secret to popularizing your profile lies in not neglecting any of your side-projects. You know those GitHub projects you haven't touched since 2000. Maybe you don't know, but they often attract traffic, but not finding an appropriate call-to-action, they end up looking at your README and then running away. With the repository I have created, you will be able to keep track of all incoming traffic on each of your projects in one place. This allows you to concentrate on the most popular projects but at the same time to fish out some interesting projects from the bottom that perhaps alone makes a few visits a month.

Take a look at the link at the bottom of the page. Please share it on twitter I put this button that can speed up your work

[![Share on Twitter](https://img.shields.io/badge/-share%20on%20twitter-blue?logo=twitter&style=for-the-badge)](https://twitter.com/intent/tweet?text=Grow%20traffic%20to%20your%20GitHub%20profile%20%23GitHubActions%20%23DEVCommunity%20%23GirlsWhoCode%20%40francescobianco%20%40javanile%0A%0Ahttps%3A%2F%2Fgithub.com%2Fjavanile%2Fgithub-traffic%0Ahttps%3A%2F%2Fdev.to%2Ffrancescobianco%2Fgrow-traffic-to-your-github-profile-2n2a)

### Add-on

Also remember to always take care of the social aspect of your projects, see for example how I configured the social card of the project I just released.

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

### Links

- The progect <https://github.com/javanile/github-traffic>
Day-65 Training At Ryaz
Tags: javascript, webdev, beginners, programming
Published: 2022-04-13 16:41:26

- Date:13/04/2022
- Day:Wednesday

Today, I started at about 10:50 am as I was doing the java script course so, I started with the remaining part so, as I was done with seven modules and started with the  eighth module so, I started with this as it is based upon high level detail of java script firstly the instructor started with redefining the java script as java script is high level,prototype based, multi paradigm,single threaded so, he stated that the things the java script perform are far than even this and after this the instruct started with java script engine as every browser have its own java script engine it have two parts so the java script code written is firstly passed as parsing and after this compilation takes place and at last execution takes place so, this way whole cycle beings and ends so, the web api's are main components of java script as with the help of the web api's the user would able to do changes on the web itself and changes does not reloading of page it occurs side by side  after this the instructor actually taught that how the java script code is executed firstly the code i.e the outside code call the functions after this there is execution of functions and waiting for callbacks and after this the instructor explained the call stack as firstly the function with arguments is put into the stack and after this the return is put into the stack and at last I got to learn about scope of variables like if we declare the variable outside the braces it's global and if it is declared inside it have access inside the function . so, this way my day ended up and I got to learn many new things.
Understanding the InterPlanetary File System (IPFS)
Tags: crypto, blockchain, storage, web3
Published: 2022-04-13 16:37:49

### What is IPFS?

- IPFS is a peer-to-peer network for storing and sharing files. Similar to a Blockchain where distributed and decentralized nodes store the ledger (the chain of blocks), nodes in IPFS stores files in different nodes.

- In IPFS, files are stored on different computers on the network. For example, a single image can be broken up into several files and stored on different computers. IPFS, like Blockchain, is decentralized:

![IPFS file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/16kvyqqfk3t8g5agu5cu.png)

- IPFS uses content-addressing instead of location-based addressing. What exactly does this mean? This basically means that instead of referring to a file based on its location, e.g. its URL, such as https://cdn.britannica.com/w:300,h:169,c:crop/24/189624-050-F3C5BAA9/Mona-Lisa-oil-wood-panel-Leonardo-da.jpg, IPFS uses the hash of the file as the addressing method. The following example makes it clear:

![image location](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t2tl1sm2q7yqpwexlwc8.png)

you can fetch this image from IPFS using this URL:

format: `https://ipfs.io/ipfs/{hash}`
example: `https://ipfs.io/ipfs/QmbjYzobwnXvpHbSBjw8aHYuWYitdr33YyoZGeN7q5J4WC`

What happens when two different users upload the same file? In this case, only one copy of the file would be stored in IPFS. This greatly reduces the storage needed to store all the files in IPFS.


- How does IPFS know that two files are identical? Remember one of the properties of hashing — collision resistance? Collision resistance means that no two different inputs should hash to the same output. And this means that if two files have the exact content, the hash of these two files would be the same.
- It is important to know that all files in IPFS are public, and so if you do not want your private files to be viewable by everyone on the network, be sure to encrypt them before you upload them to IPFS.

### So why should you use IPFS?
- Files uploaded to the IPFS are immutable. This means that once a file is uploaded to IPFS, its content cannot be changed without changing its CID. This property ensures that an item stored on IPFS is always the original copy that has not been altered. So when you retrieve a file from IPFS, you can be sure that it is the original copy.
- Files uploaded to IPFS are permanent — there is no guarantee that a file can be deleted once another node has managed to copy it.
- IPFS ensures that there is no single point of failure. As files are distributed, stored, and cached by different nodes, IPFS is resistant to centralized points of failure such as server issues or coordinated attacks.