Skip to content

Instantly share code, notes, and snippets.

View afomera's full-sized avatar
🌎
the world wide web

Andrea Fomera afomera

🌎
the world wide web
View GitHub Profile
@afomera
afomera / .zshrc
Created July 15, 2022 19:41
gitwork
function gitwork() {
local author="${1:-@me}"
local daysAgo="${2:-7}"
gh pr list -A $author -L 50 -S "merged:>=$(date -v-$daysAgo\d +%Y-%m-%d)" --json title,url,mergedAt > prs.json && ruby -e 'require "json"; prs = JSON.parse(File.read("prs.json")); prs.map { |pr| puts "<a href=\"#{pr["url"]}\">#{pr["title"]}</a><br>" }' | textutil -stdin -format html -convert rtf -stdout | pbcopy && rm prs.json
echo "Copied list of PRs to clipboard"
}
@afomera
afomera / README.md
Last active January 1, 2023 14:48
How to customize Bootstrap with esbuild-rails

How to customize Bootstrap 5 with esbuild-rails

You can see the various files added in this gist to really do the bulk of the work.

The important bits seem to be:

yarn add esbuild-sass-plugin
@afomera
afomera / wrapper.sh
Last active August 6, 2023 01:28
mc wrapper
#!/bin/bash
cd /home/minecraft/server/
screen -dmS minecraft java -Xmx1G -Xms1G -jar minecraft
@afomera
afomera / array.rb
Created June 13, 2016 03:33
Ruby Practice
# Given this array of Animals,
array = ['cow', 'sheep', 'sheep', 'pig', 'tiger', 'pig', 'lion', 'bear', 'cat']
# We can be sure we return only the unique values
animals = array.uniq
# Let's loop through and print them out
animals.each do |animal|
puts animal
end
#Pretend the sum is a big decimal and we want to conditionally append a 0 to replace
#the second dec place because ruby can chop the sec dec point
sum = "540.2"
def dec_split_sum(sum)
# Convert Sum to a string and then split it at the decimal point.
sum = sum.to_s.split('.')
if sum[1].length == 1
puts sum[0] + '.' + sum[1] + '0'
else