Skip to content

Instantly share code, notes, and snippets.

View juliocabrera820's full-sized avatar
馃摏
馃拵馃馃徏

Julio Cabrera juliocabrera820

馃摏
馃拵馃馃徏
View GitHub Profile
@juliocabrera820
juliocabrera820 / teams_spec.rb
Created April 16, 2021 02:55
example testing an active record exception
it 'returns a 404 as http status' do
expect { get '/api/v1/teams/3' }.to raise_exception(ActiveRecord::RecordNotFound)
en
@juliocabrera820
juliocabrera820 / settings.json
Created April 2, 2021 16:47
configuraci贸n vscode
{
"terminal.integrated.fontSize": 14,
"workbench.iconTheme": "material-icon-theme",
"workbench.startupEditor": "newUntitledFile",
"editor.tabSize": 2,
"editor.fontSize": 14,
"editor.lineHeight": 26,
"editor.fontFamily": "cascadia code",
@juliocabrera820
juliocabrera820 / rails_helper.rb
Last active January 15, 2021 23:50
preparar entorno de pruebas en rails
# frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
@juliocabrera820
juliocabrera820 / commit.md
Last active August 10, 2020 03:05
Usando commitlint,husky y commitizen

Instalar las siguientes dependencias de desarrollo

  • @commitlint/cli
  • @commitlint/config-conventional

Crear el archivo commitlint.config.js, y agregar el siguiente contenido

module.exports = {extends: ['@commitlint/config-conventional']}

Inicializar repositorio

@juliocabrera820
juliocabrera820 / commits.md
Last active January 3, 2025 03:37
Conventional commits

Git Commit Message Style Guide

Message Structure

A commit messages consists of three distinct parts separated by a blank line: the title, an optional body and an optional footer. The layout looks like this:

<type>(<scope>): <subject>
<BLANK LINE>
@juliocabrera820
juliocabrera820 / add_foreign_key.md
Last active June 30, 2021 23:35
Agregar llave foranea a trav茅s de una migraci贸n,y establecer la relaci贸n en los modelos

Ejemplo en el que la relacion es OneToMany

Un propietario tiene muchos autos

Se quiere agregar una llave foranea en la tabla cars

Ejecutar el siguiente comando

rails g migration AddOwnerRefToCars owner:references

Explicaci贸n comando

@juliocabrera820
juliocabrera820 / applyMiddleware.js
Last active December 17, 2020 04:46
Redux concepts
const REQUESTING_DATA = 'REQUESTING_DATA'
const RECEIVED_DATA = 'RECEIVED_DATA'
const requestingData = () => { return {type: REQUESTING_DATA} }
const receivedData = (data) => { return {type: RECEIVED_DATA, users: data.users} }
const handleAsync = () => {
return function(dispatch) {
// dispatch request action here
dispatch(requestingData())
@juliocabrera820
juliocabrera820 / get.go
Created April 5, 2020 02:53
URI y Query
package main
import (
"net/http"
"log"
"fmt"
)
func main() {
http.HandleFunc("/", func (w http.ResponseWriter,r *http.Request){
@juliocabrera820
juliocabrera820 / handleFunc.go
Created April 5, 2020 00:33
M茅todo HandleFunc
package main
import (
"net/http"
"log"
"fmt"
)
func main() {
http.HandleFunc("/", func (w http.ResponseWriter,r *http.Request){
@juliocabrera820
juliocabrera820 / 1.go
Last active April 5, 2020 00:07
Notas-HTTP-Go
package main
import (
"net/http"
)
func main(){
http.ListenAndServe("localhost:3000",nil)
}