Skip to content

Instantly share code, notes, and snippets.

View MatheusRich's full-sized avatar
🤔
Always learning, always changing

Matheus Richard MatheusRich

🤔
Always learning, always changing
View GitHub Profile
@MatheusRich
MatheusRich / compress_video
Created August 22, 2024 15:42 — forked from trvswgnr/compress_video
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@MatheusRich
MatheusRich / request.rb
Last active April 12, 2024 16:24
Request Specs vs. System Specs Comparison
require "rails_helper"
RSpec.describe "User management", type: :request do
# Runs in about 0.2 seconds (excluding file load time)
it "lists existing users" do
User.create!(name: "John", age: 30)
get users_path
expect(page).to have_table "Users" do |table|
@MatheusRich
MatheusRich / jekyll_erb.rb
Created January 13, 2024 02:13
Hacky ERB post-processor to Jekyll
module EmbeddedRuby
module ErbRenderer
class Context
def initialize(variables)
variables.each do |key, value|
instance_variable_set(:"@#{key}", value)
self.class.attr_reader key
end
end
@MatheusRich
MatheusRich / hacking-ruby-resources.md
Last active July 8, 2023 15:10
Hacking CRuby Resources

Hacking Ruby Resources

Some resources for people interested in hacking the CRuby (MRI) code base.

CRuby

Garbage Collection

@MatheusRich
MatheusRich / chatgpt.md
Last active June 16, 2023 18:37
Google Translate vs. ChatGPT: What About Portuguese?
title teaser author
Trabalhar no meu idioma nativo requer empatia
É exaustivo passar o dia todo se comunicando em um idioma que não é o nativo, mas podemos praticar a gentileza e a compreensão para aliviar parte dessa carga mental.
Matheus Richard

Algumas semanas atrás, eu estava conversando com um colega de trabalho e

@MatheusRich
MatheusRich / keybase.md
Created November 26, 2021 17:56
keybase.md

Keybase proof

I hereby claim:

  • I am matheusrich on github.
  • I am matheusrich (https://keybase.io/matheusrich) on keybase.
  • I have a public key ASADwR7uoK7Vh1ejTiSySqkdoNSUqlQMVaK5cijh0IQdFwo

To claim this, I am signing this object:

@MatheusRich
MatheusRich / erb-vs-eruby-vs-tag.rb
Created December 31, 2020 03:47
Comparing ruby native's ERB, Eruby and Rails' tag builder
require 'bundler/inline'
gemfile do
source 'http://rubygems.org'
gem 'benchable'
gem 'rails'
gem 'erubi'
end
@MatheusRich
MatheusRich / nested_properties.cr
Last active March 9, 2020 02:31
Macro for creating nested properties such as properties based on hash keys
macro define_option_property(*options)
{% for option in options %}
def {{option.id}}?
@options[:{{option}}]
end
{% end %}
end
class CLI
OPTIONS = {
@MatheusRich
MatheusRich / rspec-order-by-modification-time.rb
Created January 23, 2020 16:36
How to sort Rspec specs by file modification time
RSpec.configure do |config|
config.register_ordering(:global) do |items|
items.sort_by { |item| -File.mtime(item.metadata[:absolute_file_path]).to_i }
end
end
@MatheusRich
MatheusRich / final-evaluation.md
Last active September 3, 2019 18:37
Google Summer of Code 2019 Work Product Submission

Google Summer of Code 2019 Report

Integrate functionality from gem-web into RubyGems gem CLI

[Gem-web][gem-web] is a tool that capable of providing an interface that allows opening documentation, source code, and website of a ruby gem. My goal on GSoC was integrating it on RubyGems' CLI, which would make this feature available out of the box to all ruby users, improving their productivity, since there would have no need to search this information manually.

My Planning