teleren/devto huggingface dataset:
High Level Understanding Of Smart Contracts In Ethereum
Tags: web3, solidity, evm, smartcontract
Published: 2022-04-15 03:36:56

First, I want to thank Patrick McCorry for making all of this knowledge available to myself and others.

Second, I'd like to assert that I'm writing from an Ethereum paradigm.

## Overview

We'll be looking at smart contracts to cover what they are and how they're used in relation to Ethereum.

## What Is A Smart Contract?

> "A smart contract is a computerized transaction protocol that executes the terms of a contract. The general objectives are to satisfy common contractual conditions (such as payment terms, liens, confidentiality, and even enforcement), minimize exceptions both malicious and accidental, and minimize the need for trusted intermediaries." -Nick Szabo (1994)

Simply put, a smart contract will guarantee immutability of code (never modified), atomic operations of code (all or nothing), and public accessibility of code (no secrets).

## Smart Contracts In Ethereum

There are two types of accounts in Ethereum's database: externally owned accounts and contract accounts. Externally owned accounts are controlled by individuals (keys), and contract accounts are controlled by code (smart contracts) and storage.

Contract accounts are the reason for two of the three types of transactions on Ethereum:  creation transactions, and invocation transactions. Creation transactions carry smart contract code in their payload that get instantiated as an account in the Ethereum database. After a smart contract has been created by a creation transaction, invocation transactions become possible. Invocation transactions carry commands in their payload to invoke code in the target contract- that's stored in the database- that updates the state of the database.

## How Are Smart Contracts Built

- Solidity: Type language; object oriented.
- Ethereum Virtual Machine: Every peer on the network has an instance of the EVM their local machine; each peer deterministically executes code (transactions).
- Event Driven Programs: Smart contracts don't run themselves. Every transaction made to the blockchain (Ethereum database) costs "gas" (a unit of measurement for computation).
Crypto wallet developer
Tags: hiring
Published: 2022-04-15 03:35:37

## About Us
Aegis Associates is a company based on blockchain technology located in Malaysia. 

## About The Opportunity
We got a short term contract for 3 month to be part of our team as Blockchain Developer. The task is mainly develop a unified API for other app/website to consume it. 

Initially 4 blockchain wallet need to be developed namely bitcoin, ethereum, Solana and Binance BNB. 

## Skill & Qualifications
No preference as long as it works! 

## How To Apply
Reply to this post or PM me and offer your rate. 


_Please feel free to leave questions in the comments section._
Laravel whereDate and whereDay Example
Tags: laravel, laravel8, php, mysql
Published: 2022-04-15 03:26:09

In this tutorial, we will see laravel whereDate and whereDay example. As you all know laravel provides many inbuilt functionalities like query builder, eloquent, etc. So, here we will give you examples of whereDay and WhereDate using the date function in laravel 8.

The whereDate method is used to compare a column's value against a date. whereDate() through we can make conditions like date even column datatype timestamps.

So, Let's see laravel whereDate and whereDay example, date function in laravel 8 also you can use whereDate and whereDay functions in laravel 6, laravel 7 and laravel 8.
WhereDate()

Example :

```
$birthdate = DB::table('students')
            ->whereDate('bday', '2022-02-06')
            ->get();
dd($birthdate);
```

 In this example, you will get all results of bday which has a date like 06-02-2022.

Example : 

```
$birthdate = DB::table('students')
            ->whereDate('bday','<=','2022-02-06')
            ->get();
dd($birthdate);
```
 
---

> **_[Read Also : Laravel whereHas and orWhereHas Query Example](https://techsolutionstuff.com/post/laravel-wherehas-and-orwherehas-query-example)_**

---
 
whereDay()

The whereDay() method is used to compare a column's value against a specific day of the month, whereDay() through we can get only specific day records from your timestamps column.

Example :

```
$birthdate = DB::table('students')
            ->whereDay('bday', '2022-02-06')
            ->get();
dd($birthdate);
```

In this example, you will get all data which one date day value has 06.

--- 

You might also like :

- **_[Read Also : Laravel whereBetween Query Example](https://techsolutionstuff.com/post/laravel-wherebetween-query-example)_**

- **_[Read Also : Dropzone Image Upload Tutorial In Laravel 7/8](https://techsolutionstuff.com/post/dropzone-image-upload-tutorial-in-laravel-7-8)_**

- **_[Read Also : How To Solve The Page Expired 419 Error In Laravel](https://techsolutionstuff.com/post/how-to-solve-the-page-expired-419-error-in-laravel)_**
100 Days of Swift - Day 8 (and 9)
Tags: swift
Published: 2022-04-15 02:59:12

Continuation of [Hacking With Swift](https://www.hackingwithswift.com/) [100 Days of Swift](https://www.hackingwithswift.com/100)

**Day 8 (and 9) - Structs**

In swift structs are the most commonly used data type. Almost everything is a struct from integers to strings.

To declare a struct it is done like this: `struct Person { var name: String}` and initialize it we can do it this way: `var person = Person(name: "Davmi)"`.

Structs the same way they contain properties, can have calculated properties, and not only that but methods and even static members too. What is more surprising is that you can even have access modifiers for structs, this makes me want to wonder what are the differences between a struct and a class?.

The most important thing one can find in a struct is the observables `didSet` and `willSet` these 2 will trigger themselves as when either a property has changed or a property will change, in my opinion these are the best features of the language.
When I am pushing to remote Git repo, the push was rejected because...
Tags: git, prepush, ruby
Published: 2022-04-15 02:54:20

---
title: When I am pushing to remote Git repo, the push was rejected because...
published: true
description: Do you link pre-push Git hook?
tags: git, gitlab, prepush, ruby
cover_image: https://unsplash.com/photos/f2PXTJWrnrM/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8M3x8cmVqZWN0ZWR8ZW58MHx8fHwxNjQ5OTkwNjU1&force=true&w=640
---

[Git' `pre-push` hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) can be configured in repo by repo.

[gitlab-org/gitlab](https://gitlab.com/gitlab-org/gitlab) repo [introduced it with Lefthook gem](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52106).

Due to Ruby packages (via Rubygems), I need to update all the packages corresponding `Gemfile`/`Gemfile.lock` on `HEAD` after:

```
$ git checkout master (or main) && git pull
```

While I just wanted to modify some Markdown, why need to update all Ruby packages?

Here is the trouble I had this morning when just docs are to be updated, which demotivate me for a while:

```
$ git push origin HEAD
Lefthook v0.7.5
RUNNING HOOKS GROUP: pre-push

eslint (SKIP. NO FILES FOR INSPECTION)

graphql_docs (SKIP. NO FILES FOR INSPECTION)

  EXECUTE > docs-metadata
Documentation metadata found in 1 documentation files.


docs-deprecations (SKIP. NO FILES FOR INSPECTION)

haml-lint (SKIP. NO FILES FOR INSPECTION)

docs-removals (SKIP. NO FILES FOR INSPECTION)

  EXECUTE > vale
✔ 0 errors, 0 warnings and 0 suggestions in 1 file.


  EXECUTE > markdownlint
yarn run v1.22.17
$ markdownlint --config .markdownlint.yml doc/install/requirements.md
Done in 0.38s.


stylelint (SKIP. NO FILES FOR INSPECTION)

prettier (SKIP. NO FILES FOR INSPECTION)

rubocop (SKIP. NO FILES FOR INSPECTION)

gettext (SKIP BY SETTINGS)

  EXECUTE > danger
 Could not find omniauth-alicloud-1.0.1 in any of the sources
Run `bundle install` to install missing gems.


SUMMARY: (done in 2.59 seconds)
✔️  docs-metadata
✔️  vale
✔️  markdownlint
🥊  danger
error: failed to push some refs to 'https://gitlab.com/gitlab-org/gitlab.git'
```

For long time, it has been that independency from Ruby looks better to me in these cases (for Git hooks).

![GitLab](https://unsplash.com/photos/ZV_64LdGoao/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8NHx8Z2l0fGVufDB8fHx8MTY0OTk5MTE2Nw&force=true&w=320)

Life is too short for me to understand why it is.
Top 3 Open Source JavaScript Libraries
Tags: javascript, opensource, webdev, github
Published: 2022-04-15 02:42:58

Hello World! 👋

Who doesn't like free stuff! So today, we will be talking about my top 3️⃣ favourite JavaScript Libraries. I hope you enjoy this, so without further ado, let's get started.

## Howler JS

HowlerJS is one of my favourite JavaScript libraries. As suggested by it's title, HowlerJS **allows you to add sounds to your website.**

Link: <a href="https://howlerjs.com" target="_blank">HowlerJS</a>

## CheaterJS

CheaterJS is another excellent JavaScript library. It gives you **access to some common JavaScript functions** through an object.

Link: <a href="https://cheaterjs.com" target="_blank">cheaterJS</a>



## MedusaJS

Medusa is an open source JavaScript library **assisting you in starting your online store.**

Link: [MedusaJS](https://medusajs.com/)

I hope you enjoyed this, please take a second and comment below one of your favourite JavaScript library!
Day 559 : Steps
Tags: hiphop, code, coding, lifelongdev
Published: 2022-04-15 00:27:39

_liner notes_:
- Professional : Whew... today was all about meetings. I was able to finalize a script and map out a video for a Call for papers (CFP) for a conference whose deadline is coming up. Going to record it tomorrow since it needs to be recorded outside. Basically worked on small tasks between meetings. Couldn't really get into anything really big.

- Personal : Last night, went through some tracks for this week's radio show. Didn't really do much else, got tired and went to sleep. Didn't even watch any "Killing Eve" haha


![A mist over a field with a couple of trees in Maple Ridge, BC, Canada as the sun rises over the mountains in the distance.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/myyu724hvnrt425p5f3y.jpg)

Going to go through some more tracks for the radio show. I've been looking into getting another Chromebook that could be a replacement for this current one (been having some issues, lately) and my bigger Windows laptop for when I'm travelling. The bigger laptop really takes up a lot of space and I only use it for the radio show or the cyphers on Sundays. Going to see if I can accomplish the same radio show tasks I use the bigger laptop on my current Chromebook. That way I know it will work with a newer more powerful model. Travelling with the larger laptop and it's huge charger was kind of a pain. haha Going to do some more testing and hopefully put in an order. I was waiting for some other Chromebooks to be released, but there has been no news, preorders or release dates set. I know as soon as I buy this Chromebook, they are going to be released. haha Also, today is the 2nd day in the row that I reached my 6000 steps goal as told by my watch. 

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube LC9GI03K9CA %}
Como remover dados duplicados em go
Published: 2022-04-15 02:03:42

Ola devs e devas

Iremos usar de exemplo um slice de int para passarmos dados duplicados nele.

Criaremos um arquivo `main.go` de exemplo

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

Esse é o retorno:

`intSliceValues [1 2 3 3 4 4 5 6 7 8 9 9 9]
`

Agora iremos criar uma function para remover os dados duplicados

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

E agora no main, ficaria assim:

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

O retorno:

`intSliceValues [1 2 3 3 4 4 5 6 7 8 9 9 9]
uniqueSlice [1 2 3 4 5 6 7 8 9]`

Conclusão:

- A partir da função main, declaramos um slice. Também imprimimos o valor original da slice.

- Definimos uma função onde estamos passando os valores originais do slice e verificando as duplicatas.

- Lógica para verificação de duplicatas: Para isso definimos outra slice e atribuindo os primeiros valores verificando se o valor já existe na novo slice ou não. Ele retorna o slice sem duplicatas.

- Estamos chamando a função _removeDuplicate_ da função principal onde o slice de retorno da função é impressa.

Espeor ter ajudado.
How to Build a Nav Menu with Burger Menu Button
Tags: webdev, react, tutorial, css
Published: 2022-04-15 01:33:24

## Welcome Back!
**Where we left off** - [GitHub](https://github.com/samp-reston/my-website/tree/1e56ba24ce769664b96e5d48bffb354f654588b8)

**What we're doing today**:
- Creating a Navigation Menu

## Where am I?
I did a bit more work from where we last left off, I consolidated the component styling within the Body.css file. I have completed the content for the site. Everything but state management, a contact form, and the menu are completed.

So lets start on the menu. From the design you can see the wireframe design of the menu:

![Menu Framework](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1e10ddsxfd83dpm90pru.png)

From the component tree we can also identify that it doesn't belong inside the Body component so we will implement it outside and import it directly into the App component.

```js
function App() {
  return (
    <>
      <Menu />
      <Body />
    </>
  );
}
```

Now we need to look at the actual design of the menu and note down the key aspects of it:

![Menu Design](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5s9albzdvgubl6imp9l.png)
 
As we can see there is a dark background, a rounded corner, and a 1px border. We'll implement that with this css:
```css
.menu {
  position: absolute;
  background: rgba(0, 6, 37, .2);
  min-width: 64px;
  width: 20%;
  max-width: 16rem;
  height: 30rem;
  border-radius: 0 0 25px 0;
  border-right: 1px solid #004762;
  border-bottom: 1px solid #004762;
}
```

Now we can create two more components called Navigation and Socials, and directly import them into the Menu component.

For the Navigation implementation I simply created a `<nav>` element around 4 `<h3>` elements. For the CSS I had to remember there will be a close button in the top left of the menu so I implement a `:first-child` selector:

```css
nav {
  margin-left: 1rem;
}

nav>h3:first-child {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

nav > h3 {
  margin-top: 0.25em;
  margin-bottom: 1rem;
}
```

We're now left with:
![Nav Done](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rv1jg94k9fztqudl7emu.png)

The next part of the puzzle is creating the close button which is part of a Burger Menu component. We'll be using an outside library for ease called `hamburger-react`.

First we'll import it and then we'll add it to the Menu component.

```js
import { Divide as Hamburger } from 'hamburger-react'

import Navigation from './Navigation'
import Socials from './Socials'

function Menu() {
  return (
    <div className="menu">
      <Hamburger
        size={20}
        color='#004762'
        rounded
      />
      <Navigation />
      <Socials />
    </div>
  )
}
```

With this all done all that is left is to add the socials and then we can start using state within the app to piece all the currently static components together.

## GitHub
To view where we're at you can follow this [link](https://github.com/samp-reston/my-website/tree/3fcb6d31db24ac09654f2d7f3f1f17642394a6ab) to the final commit at the end of each post to follow along!
Create dynamic lists in React
Tags: react, reactnative, webdev, beginners
Published: 2022-04-15 01:25:36

Dynamic lists are the lists that automatically add or remove based on the conditions. They are easy to set up and they maintain themselves, which makes them a great choice for building lists around information that changes frequently.

## Create dynamic lists in React
```typescript
class App extends React.Component{
  
  state = {
    lists : {
      'list-1' : 'PHP',
      'list-2' : 'Wordpress'
    }
  }
  
    addList = (list) => {
      
      var timestamp = (new Date()).getTime();
     
      this.state.lists['list-' + timestamp ] = list;
      
      this.setState({ lists : this.state.lists });
     }
  
     removeList = (listKey) => {
      delete this.state.lists[listKey];
      this.setState({ lists : this.state.lists });
     }
  
     render() {
      return (
        <div className="component-wrapper">
          <ItemList lists={this.state.lists} removeList={this.removeList}/>
          <AddListForm addList={this.addList} />
        </div>
       );
      }
  
     }


     class ItemList extends React.Component{
       
      render () {
        return (
          <div className="container">
            <ul className="list-group text-center">
              {
                Object.keys(this.props.lists).map(function(key) {
                  return <li className="list-group-item list-group-item-info">{this.props.lists[key]} <span onClick={()=>this.props.removeList(key)}>X</span></li>
                }.bind(this))
              }
            </ul>
           </div>
          );
        }
      }
                                       
                                       

      class AddListForm extends React.Component{
        
        createList = (e) => {
          e.preventDefault();
          
          var list = this.refs.listName.value;
         
          if(list.length > 0) {
            this.props.addList(list);
          }
          
          this.refs.listForm.reset();
        }
        
        render = () => {
          return(
            <form className="form-inline" ref="listForm" onSubmit={this.createList}>
              <div className="form-group">
                <label for="listItem">
                  List Name
                  <input type="text" id="listItem" className="form-control" placeholder="e.x.lemmon" ref="listName" />
                </label>
              </div>
              <button type="submit" className="btn btn-primary">Add List</button>
            </form>
          )

        }
      }

      React.render(
        <App />,
        document.getElementById('app')
      );
```

---

Please like share subscribe and give positive feedback to motivate me to write more for you.

For more tutorials please [visit my website](https://www.w3courses.org/tutorials/).

Thanks:)
Happy Coding:)
Auto Suggestion on terminal MacOS
Tags: terminal, macos, autosuggestion, zig
Published: 2022-04-15 00:57:37

If you are tired of typing same command again and again and googling the same command again and again you don't need to do that anymore. 
Just install zsh-autosuggestion and that will do the job for you. 

For complete steps to to install zsh-autosuggestion plugin go for this video. 

{% youtube Gj5BuFwGK6o %}
How to Install Laravel 8
Tags: laravel, webdev, beginners, laravel8
Published: 2022-04-15 00:56:45

Laravel is a Free, Open-Source PHP Web Framework created by Taylor Otwell. Laravel is used to Create Dynamic Web Applications following the MVC(Model View Controller) Architecture. There are some famous applications built on Laravel like Koel, Flarum etc. In this article we learn how to install Laravel 8 and in Upcoming Tutorials will learn more about Laravel 8.

## Laravel 8 Features

## Features and improvements in Laravel 8

- Laravel Jetstream,
- model factory classes,
- migration squashing,
- job batching,
- improved rate limiting,
- queue improvements,
- dynamic Blade components,
- Tailwind pagination views,
- time testing helpers,
- improvements to artisan serve,
- event listener improvements,
- and a variety of other bug fixes and usability improvements.

## How to Install Laravel 8

## Step 1 : Laravel 8 requires the PHP Version 7.3+.

## Laravel 8 at Localhost or Local Computer
Use the Environment Variable to Set the Path of PHP Version. You need to set the PHP Path where your PHP is installed in your Path Variable of Environment Variables. For example, you have WAMP installed then your PHP path would be C:\wamp64\bin\php\php7.3.12.


![Environment Variables](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0c2e7rbgnedme7srhymu.jpg)

## Laravel 8 at Shared Hosting
You don’t need to set the any variables. Just go to your directory path where you want to install Laravel 8 with SSH Login. For example inside public_html directory.

## Laravel 8 at VPS or Dedicated Hosting
For VPS or Dedicated Hosting Like AWS or Heroku. Just Find your PHP Installed Path and go to path where you want to install Laravel 8 with SSH Login.

## Step 2 : Download the Composer

## For Localhost

To check the Composer type Composer in your Command Prompt or Terminal. If not found shows then Download the Composer and Install in your Device. Download Composer Here. You can install Composer via Setup or Command Line.

## For Shared, VPS or Dedicated Host

Login to your Terminal using SSH. And Install the Composer using the Command-Line Installation given here. To check the Composer type Composer in your Command Prompt or Terminal

## Step 3 : Install Laravel 8 Framework
After Installing the Composer Restart Your Terminal or Command Prompt. Go to your required directory or folder location where you want to install your Laravel. Then type this command given below.

```ssh
composer create-project laravel/laravel example-app
```
When installation complete. Now go to your example-app directory in your Command Prompt or Terminal. To verify your Laravel type this Command.

```ssh
php artisan -v
```

Now you have Laravel 8 Framework Installed in your device. Enjoy! and Create Beautiful Applications.

{%embed https://www.youtube.com/watch?v=VWSmM0GtBpA %}

---

Please like share subscribe and give positive feedback to motivate me to write more for you.

For more tutorials [please visit my website](https://www.w3courses.org/tutorials/).

Thanks:)
Happy Coding:)
#help useRef within useEffect
Published: 2022-04-15 00:47:56

my Goal: Is to create a simple effect that prints out a string one letter at a time.

example: string = "TEXT". it should print T E X T

Whats currently being printed is: T X T undefined

my code: 

`const [placeholder, setPlaceholder] = useState('');
const
    string = 'TEXT',
    index = useRef(0);

  useEffect(() => {
    function showChar() {
      setPlaceholder(prev => prev + string[index.current]);
      console.log(index.current)
      index.current++;
    }
    if (index.current < string.length) {
      let addChar = setInterval(showChar, 500);
      return () => clearInterval(addChar);
    }
  }, [placeholder]);

  return (
    <div>
      {placeholder}
    </div>
  )

export default App;`
Social media dashboard with light and dark theme
Tags: frontendmentor, 100daysofcode, javascript, codechallenge
Published: 2022-04-15 00:37:19

I've just completed a front-end coding challenge from @frontendmentor! 🎉

You can see my solution here: https://www.frontendmentor.io/solutions/responsivesocialmediadashboardwithdarkmodetoggle-HJrHNiAM5

Any suggestions on how I can improve are welcome!

https://github.com/Kamasah-Dickson/Social-Media-Dashboard
April 14th, 2022: What did you learn this week?
Tags: discuss, weeklyretro, weeklylearn
Published: 2022-04-15 00:30:49

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.

<center>

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

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

{%tag todayilearned %}
<!--
And remember, if something you learnt was a big win for you, then you know where to drop it as well.👇👇🏻👇🏼👇🏽👇🏾👇🏿

{%link https://dev.to/devteam/what-was-your-win-this-week-4h3g %}

<center>

![Little kid making a fist as if to say "Yes!"](https://media.giphy.com/media/6brH8dM3zeMyA/giphy.gif)
</center>
-->