Skip to content

Instantly share code, notes, and snippets.

View gbroques's full-sized avatar

G Roques gbroques

View GitHub Profile
@gbroques
gbroques / getJsonPropertyExpressions.js
Last active July 17, 2023 21:06
getJsonPropertyExpressions
/**
* Get an array of all possible JSON path expressions for an object.
*
* @example
* getJsonPathExpressions({
* "firstName": "John",
* "address": { "city": "Nara" },
* "phoneNumbers": [ { "type": "iPhone", "number": "0123-4567-8888" } ]
* })
* // => ["$.firstName", "$.address.city", "$.phoneNumbers[*].type", "$.phoneNumbers[*].number"]
@gbroques
gbroques / .gitconfig
Last active March 10, 2024 20:02
Global Git Configuration
[alias]
co = checkout
br = branch
cm = commit
st = status
graph = log --graph --oneline --decorate
fixlast = commit -a --amend -C HEAD
fl = fixlast
gr = graph
rp = rev-parse
@gbroques
gbroques / get_docstring_by_key.py
Created March 22, 2022 01:17
Retrieve the docstring of each key in a TypedDict.
'''Retrieve the docstring of each key in a TypedDict.
Consider the below example.
class Parameters(TypedDict):
"""Parameters as a TypedDict.
"""
SomeValue: float
"""Docstring of some value."""
@gbroques
gbroques / gettext.md
Last active February 13, 2022 03:26
Translating Words on Ubuntu

gettext

A common way for people to boost their language skills is to set the locale of their computer to the target language they want to learn.

Using programs when you don't know many words can be a frustrating experience unless you can easily look up the translation when needed.

The following is a guide for how to do this on Linux based operating systems like Ubuntu.

Where are translations stored?

@gbroques
gbroques / tabata-workout.md
Last active January 23, 2022 00:59
Tabata Workout

Tabata Workout

  1. Jumping Jacks
  2. Push-ups
  3. Bent Over Rows with Band
  4. Squats
  5. Monkeys (Maybe)
  6. Bear Walk
  7. Crawling
  8. Froggers (Maybe)
@gbroques
gbroques / rgb.bash
Last active November 28, 2022 20:19
RGB Colors in Bash
#!/bin/bash
# https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
# Control Sequence Introducer
# https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_Sequence_Introducer)_sequences
function csi() {
ESC="\033"
parameters=$(echo $@ | sed -e 's/ /;/g')
echo "$ESC[${parameters}m"
}
@gbroques
gbroques / watch-head.bash
Last active August 20, 2021 15:40
Watch HEAD on Git Bash
#!/bin/bash
# https://gist.github.com/espaciomore/28e24ce4f91177c0964f4f67bb5c5fda
# https://gist.github.com/gbroques/80ec85c6557e70deb845d79c6b44fcf0
ARGS="${@}"
clear;
while(true); do
OUTPUT=$(cat .git/HEAD)
ref=$(echo $OUTPUT | awk '{print $2}' | xargs -I {} cat .git/{})
commit_message=$(git log --format=%B -n 1 $ref)
clear
@gbroques
gbroques / watch-git-objects.bash
Last active August 19, 2021 00:41
Watch Git Objects on Git Bash
#!/bin/bash
# https://gist.github.com/espaciomore/28e24ce4f91177c0964f4f67bb5c5fda
# https://gist.github.com/gbroques/80ec85c6557e70deb845d79c6b44fcf0
ARGS="${@}"
clear;
while(true); do
OUTPUT=$(find .git/objects -type f -printf "%T@ %Tr %p\n" | sort -n | awk '{print $2 " " $3 " " $4}' | cat --number)
clear
printf "\n"
echo -e "${OUTPUT[@]}"
@gbroques
gbroques / react-developer-tools.md
Last active August 16, 2021 15:00
React Developer Tools

React Developer Tools

Installation

Tabs

After installation, you will get two new tabs in your Chrome DevTools:

@gbroques
gbroques / watch_git_objects.sh
Last active February 10, 2021 22:20
Watch Command for Git Objects
#!/bin/sh
watch -d "find .git/objects -type f -printf \"%Tr %p\n\" | sort -n | cat --number"