Skip to content

Instantly share code, notes, and snippets.

View lao9s's full-sized avatar

Dima Botezatu lao9s

View GitHub Profile
@mohitmamoria
mohitmamoria / README.md
Last active June 25, 2024 11:07
Inertia.js Form Helper for Axios/API calls

Inertia.js ships with a fantastic form helper but it falls short when also using API/Axios calls in your project.

Here's a composable, built on top of the Inertia's form helper that hooks into it to replace the API calls with Axios.

To use, just replace useForm with useAPIForm.

const form = useAPIForm({
    title: '',
});
@mpociot
mpociot / vite.config.js
Last active May 7, 2023 22:11
Using Vite in combination with Valet's secured sites
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import fs from 'fs';
import { resolve } from 'path';
import { homedir } from 'os';
let host = 'sendstack.test';
let homeDir = homedir();
let serverConfig = {};
@waska14
waska14 / FileHelper.php
Last active May 22, 2024 04:04
Laravel: create UploadedFile object from base64 string (autoremove temp file)
<?php
namespace App\Helpers\File;
use Illuminate\Http\File;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Arr;
class FileHelper
{
@WhereJuly
WhereJuly / composer.json
Last active April 2, 2023 00:23
Standalone Laravel 8.25 validation with genuine Laravel messages
// ...some entries
"require": {
"illuminate/validation": "^8.25",
"illuminate/translation": "^8.25"
}
// ...some more entries
@mortezashojaei
mortezashojaei / OrdersComponent.tsx
Last active June 6, 2024 08:34
Using laravel-echo in reactjs
import React, { FC } from 'react';
import { useSocket } from '@myapp/hooks';
import {Order} from '@myapp/models';
export const OrdersComponent: FC = () => {
const [orders,setOrders] = useState<Order[]>();
function addNewOrder(neworder:Order) {
@jtorvald
jtorvald / reset-audio.command
Last active March 29, 2022 11:09
Fix annoying popping crackling sound on the new MacBook Pro 16inch. Save this file and run it or copy and paste the onliner and run it in a terminal.
# if you don't understand how to save this file and execute it (open reset-audio.command)
# then copy and paste this oneliner and enter your password for privileged access:
# sudo kill -9 $(ps axc|awk "{if (\$5==\"coreaudiod\") print \$1}");
# get the process ID of coreaudio
PID=$(ps axc|awk "{if (\$5==\"coreaudiod\") print \$1}")
if [ $PID != "" ]
then
echo "Killing coreaudiod process on $PID"

Laravel Developer - Interview Exercise

  • Setup a fresh Laravel 5.8 application.
  • Use Tailwind CSS as the CSS framework.
    • CDN version is fine.
    • Bonus points if installed via NPM.
  • Create a new contact page at /contact.
  • Create a contact form on the page.
  • The form should be built as a Vue component.
  • The form should submit via ajax.
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active June 23, 2024 21:19
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

If .DS_Store was never added to your git repository, simply add it to your .gitignore file.

If you don't have one, create a file called

.gitignore

In your the root directory of your app and simply write