Skip to content

Instantly share code, notes, and snippets.

View juliocabrera820's full-sized avatar
Focusing 💎🤘🏼

Julio Cabrera juliocabrera820

Focusing 💎🤘🏼
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 March 4, 2021 14:53
Commits convencionales

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)
}