Start New Rails Project With Bun

Starting from rails 7.1 is possible to create a new rails app using bun+tailwind, to start using them only needs to run: rails new new_awesome_project -a propshaft -j bun --css tailwind --database=postgresql This won’t use the tailwind gem, it’s using npm’s packages managed with bun. to see on browser start dev server: bin/dev

December 1, 2023 · 1 min · Carlos Ramos

How to Install Livebook With Asdf

I’m reading this book Machine learning in Elixir so I tested elixir livebook on my macos using the .dmg installer , and it’s running smoothly. I decided to install it locally on my computer to know what is happening behind the scenes, so it’s straightforward; only need to run these commands: # install or update rebar and hex mix do local.rebar --force, local.hex --force # install as executable livebook mix escript....

October 13, 2023 · 1 min · Carlos Ramos

Ruby Safe Operator Tip

In my current work, I’m using (abusing) of the ruby safe operator &, which is a native implementation of the null pattern, for example, in a chain of messages: user.billings.first.cost It could be thrown an error when for example the billings of a user is empty and first returns a nil object and then nil.cost creates an Exception. With the safe operator & this avoids the error: user.billings.first&.cost # => 5....

August 11, 2021 · 2 min · Carlos Ramos

Dropbox ignore files/directories

Ignoring files or directories in dropbox is a hard thing, I thought it has like git, a .gitignore to config that, but no, we need to do a command for each file/dir, for example to ignore the files that creates a lightroom catalog (.lrcat) we need to do: xattr -w com.dropbox.ignored 1 /Users/username/Dropbox/lightroom/2021-v10\ Previews.lrdata xattr -w com.dropbox.ignored 1 /Users/username/Dropbox/lightroom/2021-v10\ Previews.lrdata xattr -w com.dropbox.ignored 1 /Users/username/Dropbox/lightroom/2021-v10\ Helper.lrdata and to not longer ignore files we need this command:...

June 25, 2021 · 1 min · Carlos Ramos

Make Backup/Restore Postgres Database With No Owner

to do backup: pg_dump dbname -O -x > backupname.sql To restore: psql dbname < backupname.sql Options documentation: -O <-- No owner -x <-- No privileges

February 23, 2021 · 1 min · Carlos Ramos

Postgres: Create Db User and bring Access

Short version: sudo -u postgres psql create database mydb; create user myuser with encrypted password 'password'; grant all privileges on database mydb to myuser;

February 2, 2021 · 1 min · Carlos Ramos

Install Ancient Gems ffi

To install a ancient ffi (<= 1.9.18) in Catalina MacOS or newer OS we need to use this command: gem install ffi -v '1.9.18' -- --with-cflags="-Wno-error=implicit-function-declaration"

November 25, 2020 · 1 min · Carlos Ramos

Configure Vim Test to Work With Docker

Recently I started to work with Docker in a project, and I ever use vim-test to run test using vim, now to integrate in current docker workflow we need to configure vim-test. For example to configure to run rspec test inside app: let test#ruby#rspec#executable = 'docker-compose exec -e RAILS_ENV=test app rspec' to run inside to already running app docker container. It is very important to add -e RAILS_ENV=test to send envinroment variables and set test env inside the rails app....

August 25, 2020 · 1 min · Carlos Ramos

How to Install Mariadb Mysql2 Driver Ruby

In a project I had troubles triying to install mysql2 gem with a older version of mariadb installed via homebrew. the solution is to send the path of the installation. gem install mysql2 -- --with-mysql-config=$(brew --prefix mariadb@10.2)/bin/mysql_config

August 19, 2020 · 1 min · Carlos Ramos

Configuring Python3 on Neovim

The idea of this post is to configure correctly the support of python3 on neovim, let’s start. first this configuration is using macOS, by default python3 is installed on macOS and the default route of the executables are: which python3 # => /usr/bin/python3 which pip3 # => /usr/bin/pip3 And that’s it! but normally if you are using homebrew you also installed the python3 using a formula, personally I do not to recomend that but it will work....

April 27, 2020 · 2 min · Carlos Ramos

How to Install Older Versions of Ruby

The problem is with RVM and renv and not with asdf, so my first suggestion is to change to asdf if you keep with RVM: install older versions of ruby <2.3 with support for openssl 1.0x you can follow these instructions: # before you install command line tools and gcc xcode-select --install brew install gcc # installation procedure cd /usr/local/src curl -O https://www.openssl.org/source/openssl-1.0.2t.tar.gz tar xzf openssl-1.0.2t.tar.gz cd openssl-1.0.2t ./Configure darwin64-x86_64-cc make sudo make install export LDFLAGS=“-L/usr/local/ssl/lib” export CPPFLAGS=“-I/usr/local/ssl/include” export PKG_CONFIG_PATH=“/usr/local/ssl/lib/pkgconfig” rvm reinstall 2....

January 24, 2020 · 1 min · Carlos Ramos

How to do email only sign up using default active-admin setup

Context The idea is to develop the same requirement as devise describe in their guide: The project is using the admin_user approach and sets the default setup included on activeadmin. (NOTE) One other recommended solution is to migrate the admin_user model to user and configure devise normally as a separate engine. Guide If you haven’t already, enable the confirmable module If you haven’t already, follow the Devise instructions for configuring views, install in app/views/active_admin/devise...

December 10, 2019 · 2 min · Carlos Ramos