Skip to content

Instantly share code, notes, and snippets.

View alexcastrodev's full-sized avatar
🚀
Let's go !!!!

Alexandro Castro alexcastrodev

🚀
Let's go !!!!
  • Flecto
  • Portugal
View GitHub Profile
upstream registry_backend {
zone registry_web 64k;
server registry_registry:5000 resolve;
keepalive 32;
}
# Servidor HTTP (porta 80) -> redireciona para HTTPS
server {
listen 80;
server_name registry.aa-planning.dev;
@alexcastrodev
alexcastrodev / deploy.yml
Created September 13, 2025 09:08
Multiple contributors on hobby plan vercel
name: App Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_WEBSITE }}
on:
push:
branches:
- main
@alexcastrodev
alexcastrodev / output_ascii.sh
Created August 6, 2025 10:10
Record a ASCII buffer
# Start record
script -q -c 'bundle exec rake parallel:spec' "tmp/rspec-$(git rev-parse --abbrev-ref HEAD)-$(date +%Y%m%d-%H%M%S).txt"
# Read with Color ( use tab for autocomplete )
less -R tmp/rspec-xxxx
# OR
script -q -c 'bundle exec rake parallel:spec' "tmp/rspec.txt"
module MyLib
class MyClass
class << self
attr_accessor :api_key
end
def self.my_method
puts "key: #{api_key}"
end
end
const online_basket = [
{ id: 1, quantity: 2 },
{ id: 3, quantity: 1 },
]
const offline_basket = [
{ id: 5, quantity: 1 },
{ id: 3, quantity: 2 },
{ id: 1, quantity: 1 }
]
export function get_nearby_delivery_fees(distance: number) {
if (!Number.isSafeInteger(distance)) {
throw new Error('Invalid distance');
}
const table_price = [
{
until: 6.5,
fee: 12.5
},
@alexcastrodev
alexcastrodev / openapi.yml
Last active October 25, 2024 18:34
reuse openapi params 3.0
openapi: 3.0.0
info:
title: Thing API
version: 1.0.0
description: An API to create and update Thing objects using JSON:API specification
paths:
/things:
post:
summary: Create a new Thing
@alexcastrodev
alexcastrodev / tests.rb
Last active July 28, 2024 12:08
parallel rake rspec
# frozen_string_literal: true
namespace :tests do
desc "Create multiple test databases, load schema, seed data, and run RSpec tests in parallel"
task :parallel, [:quantity] => :environment do |t, args|
quantity = args[:quantity].to_i
raise ArgumentError, "Please provide a valid quantity greater than 0." if quantity <= 0
test_config = ActiveRecord::Base.configurations.configurations.find { |config| config.env_name == 'test' }
raise "Test configuration not found." if test_config.nil?