Skip to content

Instantly share code, notes, and snippets.

View vinchi777's full-sized avatar

Jude vinchi777

View GitHub Profile
### Old
ap1/v1/products
filter[purchased] = true
products
attributes
- name
- amount
... etc
@vinchi777
vinchi777 / son_api_spec_param_normalizer.rb
Created August 27, 2021 12:14
Nested attribute normalizer
# Converts
# This
# {
# attributes: {
# name: 'jude',
# address.street: 'main street',
# address.city: 'cebu'
# },
# relationships: { checkout: { data: { id: 2, type: 'checkouts' } } }
# }
set nocompatible " be iMproved, required
filetype off " required
call plug#begin('~/.vim/plugged')
" let Vundle manage Vundle, required
" Plug 'gmarik/Vundle.vim'
" Color schemes
"Plug 'phanviet/vim-monokai-pro'
# frozen_string_literal: true
class MetrofoodProductSearch
include BaseService
include Filterable
attr_reader :repository, :relation, :current_user, :sort, :page, :filters
def initialize(current_user, sort, page, filters)
@repository = MetrofoodProductRepository.new
@vinchi777
vinchi777 / chain.rb
Last active April 13, 2021 07:47
Chain of responsibility pattern
# frozen_string_literal: true
module ChainOfResponsibility
attr_accessor :next
def handle(result)
@next&.handle(result) || result # Run next handler or return result
end
end
@vinchi777
vinchi777 / xmodmap
Last active February 26, 2021 11:43
Keybindings for linux
keycode Caps_Lock = Mode_switch
!Map Capslock + h/j/k/l to arrow keys
keysym h = h H Left
keysym l = l L Right
keysym k = k K Up
keysym j = j J Down
!Map Capslock + ESC to `
!Map Capslock + Shift + Esc to ~
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
@vinchi777
vinchi777 / kitty.conf
Created July 23, 2019 12:58
Kitty terminal config
launch tmux -Lkitty
font_family Fira Code Retina
font_size 10.0
bold_font auto
italic_font auto
bold_italic_font auto
/*window_margin_width 0.0*/
/*window_padding_width 0.0*/
{
"solargraph.diagnostics": true,
"solargraph.formatting": true,
"solargraph.hover": true,
"typescript.suggest.enabled": true,
"tsserver.enableJavascript": true,
"javascript.suggest.enabled": true,
"eslint.enable": true,
"eslint.filetypes": [
"javascript",
@vinchi777
vinchi777 / init.vim
Last active June 26, 2020 06:42
Nvim config
set nocompatible " be iMproved, required
filetype off " required
call plug#begin('~/.vim/plugged')
" let Vundle manage Vundle, required
" Plug 'gmarik/Vundle.vim'
" Color schemes
Plug 'phanviet/vim-monokai-pro'