Skip to content

Instantly share code, notes, and snippets.

View MarioCarrion's full-sized avatar
🗽
Empire State of Mind

Mario Carrion MarioCarrion

🗽
Empire State of Mind
View GitHub Profile
@MarioCarrion
MarioCarrion / init.lua
Last active November 12, 2024 10:10
init.vim to init.lua migration
vim.g.mapleader = ","
vim.opt.filetype="on"
vim.opt.filetype.indent="on"
vim.opt.filetype.plugin="on"
vim.opt.encoding="utf-8"
vim.opt.syntax="on"
vim.opt.compatible=false

To Record Architecture Decisions

Date: 2021-12-23

Status

Accepted

Context

@MarioCarrion
MarioCarrion / coc-settings.json
Created December 4, 2021 00:25
coc-settings
{
"languageserver": {
"go": {
"command": "gopls",
"rootPatterns": ["go.mod"],
"trace.server": "verbose",
"filetypes": ["go"]
}
}
}
@MarioCarrion
MarioCarrion / golang_ddd_project_layout.txt
Created March 22, 2021 05:46
Tree output of a Go project using "internal/" with Domain Driven Design and Hexagonal Architecture
❯ tree internal/
internal/
├── datastore
│   ├── file1.go
│   ├── file2.go
│   ├── fileN.go
├── api
│   ├── file1.go
│   ├── file2.go
│   ├── fileN.go
@MarioCarrion
MarioCarrion / init.vim
Last active July 16, 2023 14:30
Basic nvim configuration
let mapleader = ","
filetype on
filetype indent on
filetype plugin on
set encoding=UTF-8
syntax on
set nocompatible
@MarioCarrion
MarioCarrion / go.vim
Last active November 17, 2023 22:20
Nvim Go configuration
"-- vim-go specific configuration
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
@MarioCarrion
MarioCarrion / tests.sh
Created July 4, 2019 18:29
Go coverage + test for each and all packages
#!/bin/bash
#
# scripts/test.sh
#
# * Generates `coverage/index.html`: HTML artifact for download,
# * Generates `coverage/report.xml`: report of failed tests in Junit format, and
# * Validates the minimum code coverage still applies.
#
# Depends on:
# * github.com/jstemmer/go-junit-report
@MarioCarrion
MarioCarrion / Dockerfile
Created April 5, 2018 01:42
Judging go-swagger with Dredd
# vim: set syntax=dockerfile:
FROM node:9.9.0-alpine
RUN apk --update upgrade && \
apk add python && \
npm config set loglevel error && \
npm install -g [email protected] && \
apk del python && \
rm -rf /var/cache/apk/*
@MarioCarrion
MarioCarrion / embedding.go
Last active February 17, 2018 00:16
Go Tip: Embedding Example with interfaces
package main
import (
"fmt"
)
type GreetingsService interface {
SayHello() string
SayGoodMorning() string
}
@MarioCarrion
MarioCarrion / model_factory.rb
Created July 19, 2015 03:01
Dynamically create ActiveRecord models (PostgreSQL example)
# How to dynamically create model classes in PostgreSQL and ActiveRecord?
require 'active_record'
class ModelFactory < ActiveRecord::Base
self.abstract_class = true
class << self
def build_model(params)
schema = params[:schema]
table = params[:table]