Skip to content

Instantly share code, notes, and snippets.

@eduardoarandah
eduardoarandah / ok.lua
Created August 25, 2022 19:37
#tip don’t run some files in your config if requirements are needed.
-- Check requirements
local all_requirements = 1
for _, requirement in ipairs({ "git", "rg", "node", "npm" }) do
if vim.fn.executable(requirement) == 0 then
print("plugins require " .. requirement)
all_requirements = 0
end
end
if all_requirements == 0 then
@eduardoarandah
eduardoarandah / script.sh
Created August 25, 2022 13:18
neovim is your config REALLY portable?
# run ubuntu in docker
docker run -it --rm --name myubuntu ubuntu:latest
## requirements
apt update
apt -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates build-essential git ripgrep nodejs npm
## add neovim
add-apt-repository ppa:neovim-ppa/stable -y
apt update
@eduardoarandah
eduardoarandah / a.vim
Created August 24, 2022 20:42
Close all empty buffers with this function
function! CloseEmptyBuffers()
let buffers = filter(range(1, bufnr('$')), 'buflisted(v:val) && empty(bufname(v:val)) && bufwinnr(v:val)<0 && !getbufvar(v:val, "&mod")')
if !empty(buffers)
exe 'bw ' . join(buffers, ' ')
endif
endfunction
command! CloseEmptyBuffers :call CloseEmptyBuffers()
@eduardoarandah
eduardoarandah / init.lua
Last active July 6, 2022 17:50
vim to neovim migration helper
-------------------------------------------------------------------------------------
-- 1) Copy this file anywhere,
-- 2) Paste your options in "opts"
-- 3) Source it with :source %
--
-- If you get "unknown option" then remove it from opts and put it in "globals"
--
-- checkopts() checks for values that already are defaults. Remove this function when you're done
-- checkglobals() the same but for globals
--
version: "3.8"
volumes:
mysql57:
name: mysql57
mysql57conf:
name: mysql57conf # docker run -it -v mysql57conf:/app --rm busybox
services:
db: # docker compose exec db mysql -u root -pasdf -e "create database if not exists laravel;"
@eduardoarandah
eduardoarandah / minimal_init.lua
Created January 21, 2022 19:55
minimal lsp config for github issue
local on_windows = vim.loop.os_uname().version:match 'Windows'
local function join_paths(...)
local path_sep = on_windows and '\\' or '/'
local result = table.concat({ ... }, path_sep)
return result
end
vim.cmd [[set runtimepath=$VIMRUNTIME]]
@eduardoarandah
eduardoarandah / .vimrc
Created January 12, 2022 19:56
My .vimrc configuration
" I split my config into separate files so my real ~/.vimrc is just:
" source ~/scripts/.vimrc
" source ~/scripts/.vimrcplugins
" Update everthing:
" PlugUpgrade
" PlugUpdate
" CocUpdate
scriptencoding utf-8 " basic
set nocompatible " basic
@eduardoarandah
eduardoarandah / UploadController.php
Last active November 3, 2023 17:11
File upload with dropzone and alpine js
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Storage;
class UploadController extends Controller
@eduardoarandah
eduardoarandah / tailwind
Created March 18, 2021 04:11
All tailwind.css classes
-bottom-0
-bottom-1
-bottom-10
-bottom-11
-bottom-12
-bottom-14
-bottom-16
-bottom-2
-bottom-20
-bottom-24
@eduardoarandah
eduardoarandah / Login.vue
Last active March 11, 2021 02:32
Laravel Sanctum with jwt tokens in backend and vue in frontend without sessions or cors problems
<template>
<div class="">
<input v-model="user" type="text" />
<input v-model="pass" type="password" />
<button @click="login">Login</button>
<div class="">test: <button @click="test">test</button></div>
<div class="">user: <button @click="whoami">whoami</button></div>
<div class=""><button @click="logout">Logout</button></div>
<div class="">