Skip to content

Instantly share code, notes, and snippets.

View webdevmatics's full-sized avatar

Webdevmatics webdevmatics

View GitHub Profile
@joepie91
joepie91 / asynchronous.js
Last active November 29, 2021 11:16
PHP vs Node.js: Synchronous vs Asynchronous
console.log("Before the first file is read.");
hypotheticalFileGetContents("sample.txt", function(fileContents){
// fileContents now contains the file contents, this function is only called when the file read in the background has finished
console.log("After the first file has completed reading.");
});
// You've now told it to start the first read, but it won't 'block' your script execution. It will do the read in the background, and immediately move on with the rest of your code.
console.log("Before the second file is read.");
hypotheticalFileGetContents("sample2.txt", function(fileContents){
@webdevmatics
webdevmatics / Multiform.php
Last active January 6, 2022 12:51
Livewire multiform #livewire
<?php
namespace App\Http\Livewire;
use App\Customer;
use Livewire\Component;
class Multiform extends Component
{
public $name;