Skip to content

Instantly share code, notes, and snippets.

View lao9s's full-sized avatar

Dima Botezatu lao9s

View GitHub Profile
@lao9s
lao9s / README.md
Created January 23, 2024 20:45 — forked from mohitmamoria/README.md
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: '',
});
# This block redirects www to non-www
server {
listen %ip%:%proxy_ssl_port% ssl;
server_name www.%domain_idn%;
ssl on;
ssl_certificate %ssl_pem%;
ssl_certificate_key %ssl_key%;
location / {
rewrite ^(.*) https://%domain_idn%$1 permanent;
}
ssh-keygen -R [hostname] -f ~/.ssh/known_hosts
Replace [hostname] with the hostname or IP address of the server.
$blocks = collect($this->input('blocks', []))->mapWithKeys(function ($block, $index) {
return [
$block => ['sort_order' => $index]
];
})->toArray();
@lao9s
lao9s / composer.json
Created March 3, 2023 08:32
- Create new folder - Create composer.json and fill it. - Execute the command: `composer create-project --stability=dev <vendor-name>/<package-name>`
{
"name": "inovector/<project-name>",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/<vendor-name>/<repository-name>"
}
],
"require": {
"<vendor-name>/<package-name>": "dev-main"
echo "deb https://debian.octopuce.fr/snapshots/sury-php/20220630/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
wget -qO - https://debian.octopuce.fr/sury-php/apt.gpg | sudo apt-key add -
apt update
@lao9s
lao9s / Dropdown
Created August 17, 2022 08:34
import Dropdown from "@/Components/Dropdown.vue" <Dropdown align="left" :closeable-on-content="false" @close="$emit('close')"> <template #trigger> <button type="button" v-tooltip="'Emoji'" class="hover:text-o
<script setup>
import {computed, onMounted, onUnmounted, ref} from 'vue';
const props = defineProps({
align: {
type: String,
default: 'right',
},
widthClasses: {
type: String,
import {usePage} from "@inertiajs/inertia-vue3";
watch(() => usePage().props.value.flash, flash => {
if (flash.success) {
open('success', flash.success);
}
if (flash.warning) {
open('warning', flash.warning);
}
const Close = ({ customClass }) => {
return (
<svg
id="close-icon"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 10 10"
pointerEvents="none"
width={8}
height={8}
>
First pre-required step for Ubuntu:
apt-get update
apt install apt-transport-https ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
Add php repository:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update