Skip to content

Instantly share code, notes, and snippets.

View rogeruiz's full-sized avatar
🚧
socorro, estoy enquevado dentro el internet

RS Ruiz rogeruiz

🚧
socorro, estoy enquevado dentro el internet
View GitHub Profile
@rogeruiz
rogeruiz / get_title_and_url.applescript
Created February 7, 2022 19:12 — forked from vitorgalvao/Get Title and URL.applescript
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Chromium variants include "Google Chrome", "Chromium", "Opera", "Vivaldi", "Brave Browser", "Microsoft Edge".
-- Specific editions are valid, including "Google Chrome Canary", "Microsoft Edge Dev".
-- "Google Chrome" Example:
tell application "Google Chrome" to return title of active tab of front window
@rogeruiz
rogeruiz / redirects-example.diff
Created October 21, 2021 03:37
Helpful for doing redirects on pages that we drastically changed for MilMove Docusaurus
M docs/backend/guides/_category_.json
@@ -1,5 +1,5 @@
{
"label": "Guides",
"position": 3,
- "collapsed": true
+ "collapsed": false
}
M docusaurus.config.js
@@ -167,5 +167,20 @@ module.exports = {
@rogeruiz
rogeruiz / migrate-by-filename.sh
Created October 20, 2021 15:37
Find files and move them to a new place given the name of a file and the destination dirname and path.
#!/bin/bash
set -e
file_name=$1
new_path=$2
full_path=$(find docs/ -iname "${file_name}")
extracted_file_name=$(basename "${full_path}")
@rogeruiz
rogeruiz / add-js-support-to-nvim.diff
Last active October 5, 2021 16:26
Making NeoVim ready for a JSX/TSX workflow.
diff --git a/nvim/bundles.vim b/nvim/bundles.vim
index fa91ed5..c20c7e2 100644
--- a/nvim/bundles.vim
+++ b/nvim/bundles.vim
@@ -80,7 +80,11 @@
Plug 'othree/javascript-libraries-syntax.vim'
Plug 'moll/vim-node'
Plug 'marijnh/tern_for_vim'
- Plug 'mxw/vim-jsx'
+ Plug 'maxmellon/vim-jsx-pretty'
@rogeruiz
rogeruiz / check-changes.sh
Created October 1, 2021 12:27
Check Changes using Git Post Merge hook
#!/usr/bin/env bash
# Check for things that are changed. A file or directory can be checked and a
# message is printed out for the user to perform an action on. Emoji use
# encouraged for the echo message.
#
# You may copy and paste the `if changed` statement below and modify the string
# that you'd like to grep for. Make sure you escape any back-ticks "\`" in your
# echo statements in order to include them in your message.
#
@rogeruiz
rogeruiz / blog-js.js
Created September 18, 2021 15:46
Some JavaScript to create inline updates to command documentation
BlogPage.prototype.repo_migration_form_on_change = function() {
var ___iced_passed_deferral,
__iced_deferrals,
__iced_k;
__iced_k = __iced_k_noop;
___iced_passed_deferral = iced.findDeferral(arguments);
this.cleanse_repo_inputs();
this.make_repo_migration();
$("#repo-migration-extras").slideDown();
$(".myteam-2nd").text($("#repo-teamname").val());
@rogeruiz
rogeruiz / test-post-merge-hook
Last active September 1, 2021 21:22
Testing a post-merge hook the hard way
#!/usr/bin/env bash
patch_file=$(
curl -L \
-s \
https://github.com/transcom/mymove/commit/e22ed5cdd10d7fb46e448c4d99b9d98880279a5a.patch
)
# Checkout a previous branch that doesn't have migration/ changes in it.
@rogeruiz
rogeruiz / post-merge.sh
Last active September 1, 2021 00:42
Checking for file changes and running them on the `post-merge` git hook
#!/bin/bash
function changed {
git diff --name-only HEAD@{1} HEAD | grep "^$1" > /dev/null 2>&1
}
if changed 'migrations/'; then
echo "🗄 The migrations/ directory has changed. Run migrations script to get up-to-date."
fi
@rogeruiz
rogeruiz / aliases
Last active June 19, 2021 01:58
A simple way to track Terraform versions using only Bash
chooseTerraform() {
# Choose a specific version of terraform based on binaries being in your path
# with a `-` separator e.g. $PATH/terraform-v0.11.14, $PATH/terraform-v0.12.1
select version in $(ls /usr/local/bin/ | grep terraform\- | cut -d '-' -f 2)
do
if [[ $version == "" ]]
then
echo "Please choose from the available versions!"
continue
fi
@rogeruiz
rogeruiz / .aliases
Created June 17, 2021 14:12
Get all Tick timer names
tickName() {
tick list | \
rg -o "\[\s[a-z-]+\s\]" | \
sort | \
uniq | \
sd '\[\s|\s\]' ''
}
alias tick-names=tickName