teleren/devto huggingface dataset:
Run PHPUnit tests automatically before pushing code in Laravel
Tags: php, laravel
Published: 2021-06-03 18:49:13

## Install Husky

Husky is an excellent tool to automate hooks, in this post we are running phpunit tests before pushing code.

```
npm install husky@4 --save-dev
```

## Run all laravel tests after pushing code:

On `package.json` file add this code:

```json
    "husky": {
        "hooks": {
            "pre-push": "php artisan test"
        }
    },
```

## Go further

Husky also allows to add hooks before adding a commit.

## Add pre commit hooks

If you want to learn how to install and configure `PHPInsights` or any other package for static analyze the links for posts are at the end of the post.

You can run any package or custom command, in this case I will add a artisan command from `PHPInsights`.


```json
    "husky": {
        "hooks": {
            "pre-commit": "php artisan insights -v",
            "pre-push": "php artisan test"
        }
    },
```

## Adding more than one `pre-commit` hook

You can configure Husky to add more than one command on any hook by adding "&&" between every command.

In this case it would be configure to run `PHPInsights` and `PHPCSFixer`, but you can run any package or custom command:

```json
    "husky": {
        "hooks": {
            "pre-commit": "php artisan insights -v && vendor/bin/php-cs-fixer fix",
            "pre-push": "php artisan test"
        }
    },
```

That is all for this post, thanks for reading.
Linux Basic Part-00
Tags: linux, linuxbasic, kalilinux, ubuntu
Published: 2021-06-03 18:28:59

I am using *Kali linux* through out the whole **Blog Series of Linux Basic Command** to demostrate you the linux basic command. 

 1. __ls__ Command
  - ls means listing.
  - This command list the files and folders in the current directory.
![Screenshot 2021-06-03 230502](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3m0sfq5j2cbboayzre6d.jpg)
  - you can also use (**-l**) flag in ls to see the list of files and folders with, at what time they are created , permission that given to them, etc.
i.e- ls -l
![Screenshot 2021-06-03 230525](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s7yhwcof7jtxixdrb2tf.png)

2.__pwd__ Command
  - to view the current directory you are working in.
![Screenshot 2021-06-03 230605](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a0us6vpo2qbs5fmy34yi.png)

3.__clear__ Command
  - clear everything on the terminal.
![Screenshot 2021-06-03 230629](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lvcxlr5p8fmds9rg6gja.png)

4.__exit__ Command
  - this command is used to close the terminal.
![Screenshot 2021-06-03 230324](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/harmvamwhpk8hj943szn.png)

   
If you are having any problem in understanding the commands you can watch the video through the link that is given below:-
[linux basic part- 00](https://www.youtube.com)



Hope you like the 00 part of blog series of linux basic command blog.

Part 01 - [Link basic part - 01]()
Google Search Operators, Cheat Sheet
Published: 2021-06-03 18:28:33

Everyone search on Google to find answers and many problems are resolved also by using Google.

But sometimes it may happened with you too that you are trying to find something again and again but getting all unnecessary stuffs every time, and that's the point where _Search Operators_ can be used.

Search Operators are basically filters for search and can be added after a search query.
like this:
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vhqxp6xih21cygy4w712.png)
 
### List of Operators
* (` - `) Exclude : This operator excludes the results that included in this term.
eg : `best search engine -google`

* `( filetype: )` : term specified under this expression will tell search engine to show results of specific filetype.
eg: `covid 19 guidelines filetype:pdf`

* `( related: )` : As it's name say's the term specified under this expression will tell search engine to show related stuff only.
eg: `Tesla related:Scientist` or `Tesla related:Cars`

* (` " " `) must include : This is used to must include the terms in double quotes in search results 
eg: `how to make cake "egg"`

* `( site: )` on website : the website specified under this expression will only be shown in the results.
eg: `javascripts site:dev.to`

* (` | `) OR : This can be used to search 2 things at once and the pipe sign work as OR.
eg: `popup menu using javascript|jquery`

* `( intext: )` : This searches for terms in the pages body it's similar to include but slightly different, like this one we also have `intitle:` or `inurl:`

* (` @ `) Social Media : This is used to search a particular social media for results.
eg: `areeburrub @twitter`

> Above I have specified some useful expressions only which I use if you have some more comment to let me know.

<hr>

> ### Read Also:
{% post https://dev.to/areeburrub/using-weather-api-with-javascript-3a04 %}

> ### And Follow:
{% user areeburrub %}
My Awesome Collections of 200+ github repo
Tags: showdev, github, webdev
Published: 2021-06-03 18:23:13

Hello Developers , we all spends our lots of time while searching for best library , framework , beginners learning resources.In this post i will share my repos collections with you.

I have collected this repos while learning  dozens of programming language and lots of frameworks.

[All are here](https://github.com/harshmangalam?tab=stars)

{% github merry75/educative.io_courses %}
{% github hazelcast/hazelcast %}

{% github redis/redis %}

{% github react-syntax-highlighter/react-syntax-highlighter %}


{% github arnauddri/algorithms %}


{% github PaulLeCam/react-leaflet %}

{% github Leaflet/Leaflet %}


{% github feross/simple-peer %}

{% github vercel/commerce %}


{% github pion/webrtc %}

{% github golang/lint %}


{% github vuejs/vue-next %}

{% github kivy/kivy %}



{% github twintproject/twint %}



{% github dylang/shortid %}



{% github razorpay/razorpay-node %}


{% github rust-lang/rustlings %}


{% github sdmg15/Best-websites-a-programmer-should-visit %}


{% github gatsbyjs/gatsby %}


{% github trimstray/the-book-of-secret-knowledge %}


{% github donnemartin/system-design-primer %}



{% github AlexxNB/tinro %}


{% github NativeScript/NativeScript %}


{% github callstack/react-native-paper %}


{% github gofiber/recipes %}




{% github ionic-team/ionic-framework %}

{% github apollographql/apollo-server %}


{% github EbookFoundation/free-programming-books %}


{% github RafaelGoulartB/next-ecommerce %}


{% github iamvucms/react-native-facebook-clone %}



{% github pmndrs/zustand %}


{% github supabase/supabase %}


{% github stemmlerjs/software-design-and-architecture-roadmap %}


{% github hasura/graphql-engine %}


{% github gitpod-io/website %}


{% github sveltejs/realworld %}

{% github smallbets/userbase %}


{% github rodabt/yastpack %}


{% github adrianhajdin/project_video_chat %}


{% github roxiness/routify %}



{% github 30-seconds/30-seconds-of-code %}


{% github shamahoque/mern-mediastream %}

{% github alexticovschi/blogger %}


{% github mhatvan/markushatvan.com %}

{% github tailwindlabs/headlessui %}


{% github MongoEngine/mongoengine %}


{% github mongodb/motor %}


{% github GeekyAnts/NativeBase %}



{% github facebook/create-react-app %}


{% github facebook/react-native %}


{% github fastify/fastify %}


{% github moelashmawy/inventory-application %}


{% github  shamahoque/mern-classroom %}


{% github sveltejs/kit %}


{% github mongodb/mongo-go-driver %}

{% github sveltejs/sapper %}


{% github preactjs/preact %}

{% github MasterKN48/OpenBook-E-Commerce %}


{% github mattn/go-sqlite3 %}


{% github  TheComputerM/svelte-materialify %}


{% github ent/ent %}


{% github gofiber/fiber %}


{% github gorilla/securecookie %}


{% github gomodule/redigo %}


{% github boj/redistore %}


{% github gorilla/sessions %}



{% github JetBrains/kotlin %}




{% github juliangarnier/anime %}



{% github microsoft/Web-Dev-For-Beginners %}


{% github asaskevich/govalidator %}
Let's extract some juice - getting 90+ in Google Insights tool
Published: 2021-06-03 18:22:28

Hi everyone. This article is an addition to the one I wrote previously, which can be found [here](https://dev.to/przemek/front-end-studio-powered-by-solidjs-e5o). To make it short, I developed the first front-end Studio that uses HTML, CSS, and plain JS to create reactive web apps and allows to export code to JSX powered by [SolidJS](http://solidjs.com/). Today, I want to show you how exported code looks, works and performs outside of the Studio. You can watch the video showcasing everything from this blog just here:

<a href="https://www.youtube.com/embed/FCJtIY2DeHk feature=player_embedded&v=performanceofexportedcode" target="_blank">
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/08ani0eifyjlrl7d0pdd.png" alt="GlueCodes Studio" width="240" height="180" border="10"/>
</a>

#Example code

I used our website as an example code exported from the Studio. The reason is simple. You can always confirm everything you will see on YouTube or read in this blog.

![website](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9c4tak0x6g0aq9m4490.png)

#HTML to JSX

As I mentioned before in order to develop reactive web apps in GlueCodes Studio all you need to know is HTML, CSS and plain JS. The tool will take care of the rest by generating code to JSX. We are constantly improving the exported code to make it easier to read and scale outside of the Studio if necessary. So you can still deliver web apps to your clients who want to scale project later on without our tool.

![html to jsx](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rnebcm8bxvw3gd0b22wr.png)

#How fast is the end product?

Short answer - extremely. Obviously, still, a lot depends on the developer that is using the Studio exactly the same way as it would while using React or Angular. But Studio makes creating fast web apps significantly easier in a shorter amount of time. The exported code is not only well organised and can be minified, but you can also generate prerenders that will be displayed on the end user screen before JavaScript will be downloaded and injected to the browser. Our website, for example, scores around 80% on mobile in Google Insights and the tool points images (their size and format) as the main problem. We score over 95% on desktop devices. So I think that is a pretty 'decent' score for a tool that is still in Beta.


![Insights](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5alrqky36r9cmcnxi6ed.jpg)


You can try out the Studio for free here:
https://www.glue.codes

And subscribe to our channel on YT:
https://www.youtube.com/channel/UCDtO8rCRAYyzM6pRXy39__A
Fullstack GraphQL starter kit Mid-2021 update
Tags: javascript, typescript, react, node
Published: 2021-06-03 18:12:05

Hi Dev.to community, I am excited to share the Mid-2021 major update which adds tons exciting improvements to the starter kit.

<b>Changelog<b/>

- [Webpack 5](https://webpack.js.org) + [esbuild](https://esbuild.github.io/getting-started) for blazing fast backend development 🎉 
- Update [CRA](https://reactjs.org/docs/create-a-new-react-app.html) to v4 ⚡
- [Prisma](https://www.prisma.io/) to v2.20 🚀 
- Switch to [craco](https://github.com/gsoft-inc/craco) from [react-app-rewired](https://github.com/timarney/react-app-rewired) for better CRA v4 support (breaking change!)
- update all major deps (ie. react, jest, eslint)

<i>Full changelog/PR is available [here](https://github.com/karanpratapsingh/fullstack-starterkit/pull/45)


Github: https://github.com/karanpratapsingh/fullstack-starterkit

What do you think? as always feel free to reach out if you face any issues.

Happy coding :tada:
Appwrite's Isomorphic Web SDK
Tags: javascript, webdev, flutter, showdev
Published: 2021-06-03 18:09:29

We at Appwrite recently announced our new web SDK and would love to share the improvements we introduced. This article is a quick summary of what has changed and things you need to keep in mind while using the latest version of our SDK.

For the developers not much has changed, but internally some things have been rewritten that enable completely new use cases.

# Breaking Changes

Let's start with the first and only breaking change: the way our Web SDK is imported. We have switched from default to named exports. 

This allows for innovative auto completion and takes away the user's decision making when importing. Every decision you need to make slows you down, which is why things like coding conventions lead to faster development.

It also unifies the importing process, which could be different depending on the bundler in our previous approach.

```tsx
import * as Appwrite from "appwrite";

// is now

import { Appwrite } from "appwrite";
```

# Isomorphic

Previously, our SDK was initialized in the `window` object of the browser. This meant that the SDK only worked in the browser and did not cooperate with technologies like [Next.js](https://nextjs.org/), [Nuxt.js](https://nuxtjs.org/) or [Svelte Kit](https://kit.svelte.dev/), which also interact server-side in [Node.js](https://nodejs.org/en/).

That's why we refactored parts of our SDK so that it acts isomorphically and according to the environment.

```js
// Node.js
const { Appwrite } = require("appwrite");

// ESM - Modern Javascript
import { Appwrite } from "appwrite";

// IIFE - Browser
const { Appwrite } = window.Appwrite;
```

# JWT

Talking about server-side rendering, when doing SDK calls in your users scope from the server, it is not possible right away, since the HTTP-only cookie used for authentication is saved in the user's browser. That's why the Web SDK now allows to use JWT for authentication.

```js
const sdk = new Appwrite();
sdk.setJWT("eyJhbGciOiJIUzI1NiI.....");

// Prints out the user attached to the JWT
sdk.account.get().then(console.log);
```

# Typescript

Also, the first preparations for the upcoming response models have been integrated, which is going to provide full Typescript coverage across every service.

For this release, the `Promise<unknown>` generic has been added to all methods that will receive a response from the server. This way it is easier for developers right now to implement their own definitions when working with Appwrite and Typescript.

```ts
type User = {
    $id: string;
    name: string;
}

const userA = await sdk.account.get<User>();
const userB: User = await sdk.account.get();

```

# Learn More

* You can find the new version of the NPM package [here](https://www.npmjs.com/package/appwrite).  
* Checkout [Appwrite's](https://github.com/appwrite/appwrite) Github Repo.
* [Our Discord Server](https://appwrite.io/discord) is the place to be if you ever get stuck.
* You can find all our Documentation [here](https://appwrite.io/docs).
Print Statements with Frame Information
Tags: testing
Published: 2023-01-05 22:49:23

---
title: Print Statements with Frame Information
published: true
date: 2021-06-03 17:54:39 UTC
tags: Testing
canonical_url: https://brandonrozek.com/blog/printdebug/
---

I find it extremely useful to include frame information such as filename, line number, and current function in my print statements. Here’s a couple ways that I’ve done that in the past.

In C:

```
#include <stdio.h>

#define DEBUGLOG(msg) (printf("[%s:%d %s] %s\n", __FILE__ , __LINE__ , __PRETTY_FUNCTION__ , msg))

int main() {
    DEBUGLOG("Hello World");
}

```

In Python:

```
from inspect import currentframe, getframeinfo

def debuglog(m):
    frame = currentframe()
    frame_info = getframeinfo(frame)
    last_frame = frame.f_back
    last_frame_info = getframeinfo(last_frame)
    filename = last_frame_info.filename if last_frame_info is not None else "<stdin>"
    lineno = last_frame_info.lineno if last_frame_info is not None else 1
    function_name = last_frame_info.function if last_frame_info is not None else "<module>"
    print(f"[{filename}:{lineno} {function_name}] {m}")

```
How to easily test REST endpoints with Visual Studio Code
Tags: opensource, productivity, code, beginners
Published: 2021-06-03 17:52:29

---
title: How to easily test REST endpoints with Visual Studio Code
published: true
description: We'll investigate how to easily test REST endpoints with Visual Studio Code
tags: opensource, productivity, code, beginners
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ttnr90vvgew7c052dj3.png
---

Hello everyone, 

I've been asked a few times why I don't use PostMan anymore and the answer is because I can just do it all in Visual Studio Code with one single plug-in. Checkout the video below and hopefully you'll find it helpful! 

Video (13 mins)
{% youtube LmfdPsq4IVs%} 

Conclusion

Feel free to checkout my [Twitch streams](https://twitch.tv/mbcrump) as we learn about security and app development or you can watch the condensed version of all of my streams by subscribing to my [YouTube](https://youtube.com/mbcrump). 

Stay connected with me on social platforms for daily software development news.

-[Twitter](https://twitter.com/intent/follow?screen_name=mbcrump) | [Twitch](https://twitch.tv/mbcrump) | [Instagram](https://instagram.com/mbcrump) | [YouTube](https://youtube.com/mbcrump) | [GitHub](https://github.com/mbcrump) | [Website](https://www.michaelcrump.net)
A Svelte Open Source Project to contribute to
Published: 2021-06-03 17:50:35

## [Rhmye](https://github.com/Rhyme-Player/RhymeApp)
A beautiful looking music player which supports
- Playing online music and local music files
- Create custom playlists
- view albums
- view artists
- favorite music to view them in the favorites page and help us know what kind of music you love
- Notification area to inform you of any errors, warnings or info turn it of if you do not want it
- Settings page to make the app work the way you want
- More are coming
Arrow functions, the basics
Tags: beginners, javascript
Published: 2021-06-03 17:47:08

##Arrow functions##
Arrow functions is very simple and short syntax for creating functions, it’s often better than Function Expressions.
 it looks like this:
*let func = (arg1, arg2, ..., argN) => expression*
This creates a function func that accepts arguments arg1..argN, then evaluates the expression on the right side with their use and returns its result.
Let’s see a solid example:
let add = (x, y) => x + y;
alert( add(1, 2) ); // 3
/* This arrow function is a shorter form of:
let add = function(x, y) {
  return x + y;
};*/

If we have only one arg, then parentheses around parameters can be ignored, making that even smaller. 
e.g.
let num = n => n * 2;
// roughly the same as: let num = function(n) { return n * 2 }
alert( num(3) ); // 6

If there are no arguments, parentheses will be empty (but they should be present):
let myName = () => alert("Talha!");
myName();

*Multiline arrow functions*
let sum = (a, b) => {  // the curly brace opens a multiline function
  let result = a + b;
  return result; // if we use curly braces, then we need an explicit "return"
};
alert( sum(1, 2) ); // 3

For now, we can already use arrow functions for one-line actions and callbacks.
I will share more in my upcoming posts.
Thanks for reading
Find the index of the maximum item of an array
Tags: javascript, react, vue
Published: 2021-06-03 17:37:53

Find the index of the maximum item of an array


const indexOfMax = arr => arr.reduce((prev, curr, i, a) => curr > a[prev] ? i : prev, 0);

// Examples
indexOfMax([1, 3, 9, 7, 5]);        // 2
indexOfMax([1, 3, 7, 7, 5]);        // 2
เรื่องใส่ id สลับที่กัน
Tags: rust, statictype
Published: 2021-06-03 17:29:14

---
title: เรื่องใส่ id สลับที่กัน 
published: true
description: 
tags: rust,statictype
//cover_image: https://direct_url_to_image.jpg
---

เคยโพสต์ที่ qua.name แล้วเมื่อเดือนธันวาคม พ.ศ. 2563

เขียน #rustlang แบบ 

````Rust
(word_id, textunit_id) 
````

วันเดียวพอจำได้หรอก เขียนไปนาน ๆ อาจจะพลาดใส่ 

````Rust
(textunit_id, word_id)
```` 

ก็ได้

อันนี้ static type อาจจะวืดเพราะทั้ง textunit-id และ word-id ก็เป็น u32 ทั้งคู่ อาจจะแก้แบบนี้สร้าง type มาใหม่เลย WordId กับ TextunitId แต่มันก็เหนื่อยอยู่นะ

ไม่ก็ใช้ struct แทน เช่น

````Rust
struct WordIdTextunitId {
    word_id: u32,
    textunit_id: u32,
}
````

อันนี้เขียนง่ายดี แต่ compiler ไม่ได้ช่วยอะไรมากนะ ก็คือ programmer ก็ดูเอาเมื่อไหร่เขียน

````Rust
WordIdTextunitId { word_id: textunit_id, textunit_id: word_id }
````

แบบนี้ก็ผิด โปรแกรมเมอร์เห็นเอง แต่ใส่สลับกัน compiler มันก็ผ่านนะ

แล้วคิดไปติดมามันก็พอกับเขียน Clojure เลย

````Clojure
{:word-id word-id
 :textunit-id textunit-id}
````
แบบนี้ก็ชัดเจนอยู่แล้ว ไม่ต้องประกาศ struct ด้วย หรือจะใช้ defstruct เลยก็ได้

ใน Common Lisp ก็คล้าย ๆ กัน def struct ก็ได้ จะทำเป็น alist ก็ได้

````Lisp
(list (cons :word-id word-id) 
       (cons :textunit-id textunit-id))
````

แบบนี้ก็ได้

กลับมา Rust จะจัดหนักแบบ ทำแบบนี้ก็บึ้มอยู่ดี

````Rust
type WordId = u32;
type TextunitId = u32;

struct WordIdTextUnitId {
    word_id: WordId,
    textunit_id: TextunitId,
}

fn main() {
   let w: WordId = 1;
   let t: TextunitId = 2;
   let x = WordIdTextUnitId { word_id: t, textunit_id: w};
}
````

สลับได้ compiler ไม่ช่วยอะไร

แต่ถ้าทำเป็น struct หมดเลย

````Rust
struct WordId(u32);
struct TextunitId(u32);

struct WordIdTextUnitId {
    word_id: WordId,
    textunit_id: TextunitId,
}

fn main() {
    let w = WordId(1);
    let t = TextunitId(2);
    let x = WordIdTextUnitId { word_id: t, textunit_id: w};
}
````

แบบนี้ compiler มันจะช่วยได้รู้แล้วว่าสลับกัน

แต่ก็จะมาเจอว่าผมอยากได้ 

````Rust
let v = w + 1; 
````

แบบนี้ทำไง ก็มีวิธีทำหลายทางนะ เพียงแต่มันก็ต้องออกแรง
Cómo compartir con otras personas tu proyecto PHP ya terminado
Tags: php, herramientas, infraestructura
Published: 2021-09-16 12:10:13

---
title: Cómo compartir con otras personas tu proyecto PHP ya terminado
published: true
date: 2021-06-03 17:26:00 UTC
tags: PHP,Herramientas,Infraestructura
canonical_url: https://academy.leewayweb.com/como-compartir-con-otras-personas-tu-proyecto-php-ya-terminado/
---

Listo. Terminado. Finito. Ah… qué placer, ¿no? Después de horas frente a la pantalla, incontables tazas de café y miles de bugs resueltos, por fin llegará el merecido descanso… sólo falta hacer la demo para el cliente. Es que si no se hace el cliente no podrá dar su visto bueno y sin él… difícil […]

La entrada [Cómo compartir con otras personas tu proyecto PHP ya terminado](https://academy.leewayweb.com/como-compartir-con-otras-personas-tu-proyecto-php-ya-terminado/) se publicó primero en [Leeway Academy](https://academy.leewayweb.com).
Disable creation of .DS_Store files
Published: 2021-06-03 16:52:26

```
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

```


Read:
```
defaults read com.apple.desktopservices
```

Remove setting:
```
defaults delete com.apple.desktopservices DSDontWriteNetworkStores
```