Skip to content

Instantly share code, notes, and snippets.

View cherryramatisdev's full-sized avatar
🏠
Working from home

Cherry Ramatis cherryramatisdev

🏠
Working from home
View GitHub Profile
#!/usr/bin/env bash
pbcopy
pane_count=$(tmux list-panes | wc -l)
edit() {
local current_pane="$(tmux list-panes -F "#{pane_active} #{pane_pid} #{pane_current_command}" | grep "^1" | awk '{print $3}')"
if [ "$current_pane" = "nvim" ] || [ "$current_pane" = "nvi" ] || [ "$current_pane" = "Vim" ] || [ "$current_pane" = "vim" ]; then
let mapleader = ' '
" Enable filetype detection and plugin functionality
filetype plugin on
" Enable syntax highlighting
syntax on
" Set the tab size to 2 spaces
set tabstop=2
@cherryramatisdev
cherryramatisdev / pkg.pl
Last active December 14, 2023 17:44
Script to automagically detect the different node package managers
#!/usr/bin/env perl
use v5.14;
use warnings;
use strict;
my $dir = `git rev-parse --show-toplevel`;
$dir =~ s/^\s+|\s+$//g;
@cherryramatisdev
cherryramatisdev / .tmux.conf
Created December 12, 2023 17:32
tmux.conf
set -g terminal-overrides ',xterm-256color:Tc'
set -g default-terminal "tmux-256color"
set -as terminal-overrides ',xterm*:sitm=\E[3m'
# start window indexing at one instead of zero
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
setw -g mode-keys vi
# fix accidently typing accent characters, etc.
@cherryramatisdev
cherryramatisdev / list_discussions.sh
Last active November 28, 2023 14:11
How to list all the discussions within a repo
#!/usr/bin/env bash
gh api graphql \
-f query="
query {
repository(owner: \"ORG\", name: \"REPO_NAME\") {
discussions(first: 29) {
edges {
node {
title
alias sync="stow . -t ~/"
alias chmox="chmod +x"
alias l=exa
alias ls=exa
alias ll="exa -ll"
alias la="exa -la"
alias lg=lazygit
# alias vi="$EDITOR"
alias vi="vim"
@cherryramatisdev
cherryramatisdev / result_monad.rb
Created October 21, 2023 04:46
A simple result monad implemented with type safety using sorbet
# frozen_string_literal: true
# typed: true
require 'sorbet-runtime'
# Result...
module Result
extend T::Sig
# Ok...
@cherryramatisdev
cherryramatisdev / pull_request.lua
Last active October 12, 2023 23:55
Simple module to manage pull request creation within neovim
local M = {}
---@return 'main' | 'develop'
local function decide_base_branch()
if vim.fn.system 'git branch --contains develop' == 'error: malformed object name develop' then
return 'main'
end
return 'develop'
end
function! project#Switch(path) abort
if tabpagenr('$') == 1
%bd
endif
execute 'cd ' . a:path
execute 'Dirvish'
endfunction
function! s:ReturnProjectRoot() abort
" TODO: This doesn't work on non git projects
return system('git rev-parse --show-toplevel')->substitute('\n', '', '')
endfunction
function! github#pr#CreatePr() abort
let l:template_path = s:ReturnProjectRoot() . '/.github/pull_request_template.md'
call execute('tabe ' . tempname())