Skip to content

Instantly share code, notes, and snippets.

View jesseleite's full-sized avatar

Jesse Leite jesseleite

View GitHub Profile
@jesseleite
jesseleite / toggle_surrounding_quote_style.lua
Created December 21, 2023 04:53
Toggle surrounding quote style mapping in Neovim (probably not perfect lol!)
local toggle_surrounding_quote_style = function ()
local current_line = vim.fn.line('.')
local next_single_quote = vim.fn.searchpos("'", 'cn')
local next_double_quote = vim.fn.searchpos('"', 'cn')
if next_single_quote[1] ~= current_line then
next_single_quote = false
end
if next_double_quote[1] ~= current_line then
@jesseleite
jesseleite / minimal.lua
Created April 13, 2022 17:12
Minimal nvim config for nvim-treesitter testing
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
require('packer').startup {
{
'wbthomason/packer.nvim',
{
'nvim-treesitter/nvim-treesitter',
function! ShtuffStrategy(cmd)
call system("shtuff into test " . shellescape("clear;" . a:cmd))
endfunction
let g:test#custom_strategies = {'shtuff': function('ShtuffStrategy')}
let g:test#strategy = "shtuff"
@jesseleite
jesseleite / SelectModifier.php
Created February 21, 2019 17:06
Statamic v2 array batch addon idea
<?php
namespace Statamic\Addons\ArrayBatch;
use Statamic\Extend\Modifier;
class SelectModifier extends Modifier
{
/**
* Modify a value
<template>
<div class="tooltip-component" @mouseenter="show" @mouseleave="hide">
<div class="tooltip" :class="{ visible: isVisible }">
<span class="tooltip-text">{{ text }}</span>
</div>
<slot></slot>
</div>
</template>
<script>
@jesseleite
jesseleite / # php@7.1 - 2018-03-31_21-54-39.txt
Created April 2, 2018 15:09
php@7.1 on macOS 10.13.3 - Homebrew build logs
Homebrew build logs for php@7.1 on macOS 10.13.3
Build date: 2018-03-31 21:54:39
@jesseleite
jesseleite / sendString.js
Last active March 26, 2018 00:17
Digital Ocean console sendString() for pasting
var sendString = (function(rfb, force, sendDelay) {
sendDelay = sendDelay || 25;
var _q = [];
var _qStart = function() {
var chr = _q.shift();
if (chr) {
rfb.sendKey(chr);
setTimeout(_qStart, sendDelay);
}
};
-- The following is a script to bring back VI mode in Sierra.
-- See: https://gist.github.com/juanmiret/81a21a5ae8d6b6061b0a4e72a8be61b2
local module = {}
module.debugging = false -- whether to print status updates
local eventtap = require "hs.eventtap"
local event = eventtap.event
local inspect = require "hs.inspect"
<?php
namespace App\DB\Listeners;
class Cascade
{
/**
* Trigger cascade function on Eloquent Model if defined in softdeletes config.
* @param object $model Eloquent Model
@jesseleite
jesseleite / swap.sh
Created April 9, 2016 15:30
1G Swap Forge Script/Recipe
if [ -f /swapfile ]; then
echo "Swapfile already exists."
exit 1
fi
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
sh -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'