Skip to content

Instantly share code, notes, and snippets.

View mabsboza's full-sized avatar
🤙

JamesCode mabsboza

🤙
View GitHub Profile
if [ "$#" -ne 1 ]; then
echo "Usage: $0 [personal|work1|work2]"
exit 1
fi
if [ "$1" == "personal" ]; then
git config --global user.name "Tu Nombre"
git config --global user.email "[email protected]"
elif [ "$1" == "chile" ]; then
git config --global user.name "Tu Nombre Trabajo 1"
1. Instalar el paquete de Intercom para PHP
Primero, instala el paquete oficial de Intercom para PHP utilizando Composer:
<dl>
bash
composer require intercom/intercom-php
</dl>
class MetaContractorObject
VALID_SUB_CATEGORIES = ['PERMANENTE', 'ESPORÁDICO', 'HABITUAL'].freeze
attr_accessor :sub_category, :meta_contractor_id
def initialize(meta_contractor_id, sub_category)
raise ArgumentError, "Invalid sub_category: #{sub_category}. Must be one of: #{VALID_SUB_CATEGORIES.join(', ')}" unless VALID_SUB_CATEGORIES.include?(sub_category)
@meta_contractor_id = meta_contractor_id
@sub_category = sub_category
class ContractorObject
attr_accessor :activity, :contractor_id
def initialize(activity, contractor_id)
raise ArgumentError, "Activity must not be empty" if activity.nil? || activity.strip.empty?
@contractor_id = contractor_id
@activity = activity
end
end
require 'aws-sdk-s3'
require 'uri'
class S3Downloader
def initialize(region:, access_key_id:, secret_access_key:, bucket_name:)
@s3 = Aws::S3::Client.new(
region: region,
access_key_id: access_key_id,
secret_access_key: secret_access_key
)
class User < ApplicationRecord
validates :name, presence: true, length: { maximum: 50 }
validates :email, presence: true, length: { maximum: 255 }
end
# spec/models/user_spec.rb
require 'rails_helper'
RSpec.describe User, type: :model do