How to Sync Vscode Plugins Over Your Dotfiles

I was looking a simple way to get sync all of my current setup of vscode, I did’t found a proper way to do with another plugin, but I found a commands to do this sync. first to have a list of plugins installed and save to a file: code --list-extensions > vscode-extensions.list to restore, read that file and install all plugins: cat vscode-extensions.list | xargs -L 1 code --install-extension # using bat bat vscode-extensions....

October 21, 2019 · 1 min · Carlos Ramos

Add Array of Types in a Column using Postgres and Rails

Recently I found a nice feature when defining a column on migrations, is to use array option in the creation of a column: class MyMigration < ActiveRecord::Migration[5.2] def change # Defines a column that stores an array of a type. add_column :transactions, :categories, :string, array: true, default: [] end end With this on categories you can storage an array of values, it’s useful instead of use jsonb because as json you may also need to create the key to store values (hash)....

October 14, 2019 · 1 min · Carlos Ramos

Install yarn if you are using Nodejs with ASDF

I’m using ASDF to install any language that I needed, so problems become when I have to install yarn a js package manager but to do that has a lot of ways of install yarn and problems increasing with nodejs installed using ASDF more problems become using the brew recipe and it doesn’t work with ASDF. I found a practical solution: is to install a separate yarn recipe into ASDF....

September 24, 2019 · 1 min · Carlos Ramos

Configure and install last elixir-ls in Neovim

The last version of ElixirLS have a lot of improvements, for example a new robust code suggestion provided by elixir-sense, intellisense with code documentation and other larger changes, but now i didn’t see an actual release to use it, so in this post we will clone the last repo, compile and will install in our local dev to take advantage of these new features. First clone and generate the executables of elixirLS:...

September 22, 2019 · 1 min · Carlos Ramos

Upgrade to Latest Version on ASDF

ASDF is an incredible version manager, to install/upgrade to latest version available of an language you can do the following steps: asdf list-all <language> this show all of the versions available to install, select the latest: asdf install <language> x.y.z and edit if you have a global ~/.tool-versions to use that version everywhere: <languaje> x.y.z real example to upgrade to latest version of erlang (10/17/2019): asdf list-all erlang asdf install erlang 22....

September 17, 2019 · 1 min · Carlos Ramos

Enable Prettier in Ember templates

Prettier is an opinionated code formatter, has built-in a lot of code formatters for languages, one of that is for handlebars (glimmer/mustache) but is hidden by default, to enable we only need to do this: create a .prettierrc in your home (~) with : { "overrides": [ { "files": "*.hbs", "options": { "parser": "glimmer" // ... other custom configurations } } ] } and now you can use in your favorite editor or simple use directly with the CLI, for example:...

September 16, 2019 · 1 min · Carlos Ramos

How to Show Hex Colors on Neovim

One thing that I like is to show HEX colors on css, html and even on javascript using NEOVIM, to do that I was using Colorizer plugin but now I switched to use vim-hexokinase and it’s asynchronous! to install you might need to install before go language: brew install go and this is my config: let g:Hexokinase_ftOptInPatterns = { \ 'css': 'full_hex,triple_hex,rgb,rgba,hsl,hsla,colour_names', \ 'html': 'full_hex,rgb,rgba,hsl,hsla', \ 'javascript': 'full_hex,rgb,rgba,hsl,hsla' \ } let g:Hexokinase_virtualText = ' ██████' watch all of my dotfiles...

September 12, 2019 · 1 min · Carlos Ramos

How to Manage Environment Variables

In many projects that i have been working I want to manage GLOBAL’s variables, so to do that use direnv. to install (MacOS): brew install direnv Now the project needs to create a file .envrc like this: # Stripe Credentials export STRIPE_PRIVATE_KEY="xxxxxxxxxxxx" export STRIPE_WEBHOOK_SECRET="xxxxxxxxxxxxxxxx" entering in that directory direnv asks to allow the execution and use of that variables, so: direnv allow . And that’s it! you don’t need a custom solution for every programming language....

September 12, 2019 · 1 min · Carlos Ramos

Create a Form With Two Actions on Activeadmin

In a project that already using Activeadmin I had the requeriment of modify the actual form to create a student, but without validating that, so the solution was create into the model of active admin form and declare the form with two actions, one with the clasical behaviour and other when passed the params[:managed] with a custom route ActiveAdmin.register InvestmentItem do # .. form do |f| f.inputs do f.input :student, as: :select, collection: User....

September 11, 2019 · 1 min · Carlos Ramos

“NewRailscasts” My first VScode Theme

I ported my adaption of the ancient railscasts theme for (neo)vim to VSCode, its solarized, supports very well javascript, typescript, ruby and elixir, here’s some screenshots: TypeScript Html + erb Elixir If you like try to install only follow this link or search in Extensions “New Railscasts”, also if you use vim you can install the new-railscasts from my repo.

November 27, 2018 · 1 min · Carlos Ramos

My first elixir library: SoftRepo

don’t destroy sensible data It’s a placer to announce my first library, this handle soft-delete using directly a Repo wrapper, so the main idea is to have a global lib/module that represent all of the logic to do soft-delete of records. The setup and usage has been written on the README of soft_repo. Future The idea is to have a basic library that handles soft-delete, but in a future I’ll implement:...

October 3, 2018 · 1 min · Carlos Ramos

Lint and Format code with vim and ALE

Currently I’m writing JS and Elixir code and I’ve using a lot of plugins to help me about misspelling in my code, first I was using Syntastic, later I was using Neomake but now I fell in love with ALE and I try to explain why. Ale knows clearly about if a plugin/addon shows an error that plugin/addon can fix that error if is possible. For example if I’m using eslint and I see this error:...

November 15, 2017 · 2 min · Carlos Ramos