Skip to content

Instantly share code, notes, and snippets.

Avatar
😂
https://lol.rogeruiz.com

Roger Steve Ruiz rogeruiz

😂
https://lol.rogeruiz.com
View GitHub Profile
@rogeruiz
rogeruiz / examples.md
Created Jun 8, 2022 — forked from ef4/examples.md
Webpack 5 Node Polyfills Upgrade Cheatsheet
View examples.md

Webpack 5 Node Polyfills Upgrade Cheatsheet

Webpack 4 automatically polyfilled many Node APIs in the browser. This was not a great system, because it could lead to surprisingly giant libraries getting pulled into your app by accident, and it gave you no control over the exact versions of the polyfills you were using.

So Webpack 5 removed this functionality. That means you need to make changes if you were relying on those polyfills. This is a quick reference for how to replace the most common patterns.

List of polyfill packages that were used in webpack 4

For each automatically-polyfilled node package name on the left, this shows the name of the NPM package that was used to polyfill it on the right. Under webpack 5 you can manually install these packages and use them via resolve.fallback.

View mirror.sh
#!/bin/sh
set -eufo pipefail
if [ "$#" -ne 2 ]; then
echo "usage: $0 source_repo_url target_repo_url" >&2
exit 1
fi
SOURCE_URL="$1"
@rogeruiz
rogeruiz / launch.json
Created Mar 10, 2022
Launch test functions in MilMove using F5 key
View launch.json
{
"configurations": [
{
"name": "Launch test function in MilMove using F5 key",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${relativeFileDirname}",
"args": [
"-test.v"
@rogeruiz
rogeruiz / get_title_and_url.applescript
Created Feb 7, 2022 — forked from vitorgalvao/get_title_and_url.applescript
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
View get_title_and_url.applescript
-- 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 Oct 21, 2021
Helpful for doing redirects on pages that we drastically changed for MilMove Docusaurus
View redirects-example.diff
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 Oct 20, 2021
Find files and move them to a new place given the name of a file and the destination dirname and path.
View migrate-by-filename.sh
#!/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 Oct 5, 2021
Making NeoVim ready for a JSX/TSX workflow.
View add-js-support-to-nvim.diff
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 Oct 1, 2021
Check Changes using Git Post Merge hook
View check-changes.sh
#!/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 Sep 18, 2021
Some JavaScript to create inline updates to command documentation
View blog-js.js
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 Sep 1, 2021
Testing a post-merge hook the hard way
View test-post-merge-hook
#!/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.