Skip to content

Instantly share code, notes, and snippets.

@yelocode
yelocode / Form.php
Created December 7, 2023 20:40
Livewire 3 dependent Dropdown
<?php
namespace App\Livewire;
use App\Models\Company;
use App\Models\Phone;
use Livewire\Attributes\Computed;
use Livewire\Component;
class Form extends Component
@romainl
romainl / grep.md
Last active October 4, 2024 07:27
Instant grep + quickfix

FOREWORDS

I don't mean the snippet at the bottom of this gist to be a generic plug-n-play solution to your search needs. It is very likely to not work for you or even break things, and it certainly is not as extensively tested and genericised as your regular third-party plugin.

My goal, here and in most of my posts, is to show how Vim's features can be leveraged to build your own high-level, low-maintenance, workflows without systematically jumping on the plugins bandwagon or twisting Vim's arm.


Instant grep + quickfix

@rodricels
rodricels / .tmux.conf
Last active April 21, 2024 12:22
tmux configuration, mouse copy & paste added
# My tmux configuration, partly based on https://github.com/wbkang/wbk-stow/blob/master/tmux-config/.tmux.conf
# Scroll History
set -g history-limit 50000
# show messages for 4 seconds instead
set -g display-time 4000
# set first window to index 1 (not 0) to map more to the keyboard layout
set-option -g renumber-windows on
@john-science
john-science / snake.sh
Created August 7, 2017 22:53
The classic Snake game, written in Bash.
#!/bin/bash
#
# Centipede game
#
# v2.0
#
# Author: sol@subnetzero.org
#
# Functions
@romainl
romainl / paste.vim
Last active June 20, 2024 23:06
Sharing is caring
" Mac OS X (requires curl)
" ------------------------
command! -range=% SP <line1>,<line2>w !curl -F 'sprunge=<-' http://sprunge.us | tr -d '\n' | pbcopy
command! -range=% CL <line1>,<line2>w !curl -F 'clbin=<-' https://clbin.com | tr -d '\n' | pbcopy
command! -range=% VP <line1>,<line2>w !curl -F 'text=<-' http://vpaste.net | tr -d '\n' | pbcopy
command! -range=% PB <line1>,<line2>w !curl -F 'c=@-' https://ptpb.pw/?u=1 | tr -d '\n' | pbcopy
command! -range=% IX <line1>,<line2>w !curl -F 'f:1=<-' http://ix.io | tr -d '\n' | pbcopy
command! -range=% EN <line1>,<line2>w !curl -F 'file=@-;' https://envs.sh | tr -d '\n' | pbcopy
command! -range=% XO <line1>,<line2>w !curl -F 'file=@-' https://0x0.st | tr -d '\n' | pbcopy
command! -range=% TB <line1>,<line2>w !nc termbin.com 9999 | tr -d '\n' | pbcopy
- go to http://invisible-island.net/xterm/ and download source file (e.g. http://invisible-island.net/datafiles/release/xterm.tar.gz)
- according to http://web.archive.org/web/20130125000058/http://www.frexx.de/xterm-256-notes/ configure with ./configure --enable-256-color
- summarized:
- ./configure --enable-256-color
- sudo make
- check colors with http://web.archive.org/web/20130125000058/http://www.frexx.de/xterm-256-notes/data/256colors2.pl, see http://web.archive.org/web/20130125000058/http://www.frexx.de/xterm-256-notes/
@mhulse
mhulse / fromhex.bash
Last active September 13, 2024 20:23
Bash function to convert hex to 256 terminal color.
# fromhex A52A2A
# fromhex "#A52A2A"
# BLUE_VIOLET=$(fromhex "#8A2BE2")
# http://unix.stackexchange.com/a/269085/67282
function fromhex() {
hex=$1
if [[ $hex == "#"* ]]; then
hex=$(echo $1 | awk '{print substr($0,2)}')
fi
r=$(printf '0x%0.2s' "$hex")
@XVilka
XVilka / BiDiSupport.md
Last active August 9, 2024 06:36
BiDirectional Text

This gist will show the support of BiDirectional text in the terminal emulators and console programs. You can read more about the standardization efforts at the dedicated page of FreeDesktop Terminal BiDi working group.

How to test

Logical Order ◀ ◀ ◀ RTL LTR ▶ ▶ ▶
WHAT IS UNICODE؟ in arabic in arabic ؟EDOCINU SI TAHW ؟EDOCINU SI TAHW in arabic
ما هو الترميز الموحد يونيكود؟ in Arabic ما هو الترميز الموحد يونيكود؟ in Arabic
@cormacrelf
cormacrelf / wordcount.vim
Created May 13, 2014 17:04
The best vim status line word count function. Grabs count from g<C-g> output, counts inside visual selections, and only re-runs itself when a buffer is modified, if it hasn't run yet, if we're in visual at all, or if we have changed modes since last run.
function! WordCount()
let currentmode = mode()
if !exists("g:lastmode_wc")
let g:lastmode_wc = currentmode
endif
" if we modify file, open a new buffer, be in visual ever, or switch modes
" since last run, we recompute.
if &modified || !exists("b:wordcount") || currentmode =~? '\c.*v' || currentmode != g:lastmode_wc
let g:lastmode_wc = currentmode
let l:old_position = getpos('.')