Skip to content

Instantly share code, notes, and snippets.

View mrbongiolo's full-sized avatar
🚀
Just shiplling

Ralf Schmitz Bongiolo mrbongiolo

🚀
Just shiplling
View GitHub Profile
@mrbongiolo
mrbongiolo / precompile.md
Last active February 27, 2023 00:16
HOW TO: Rails 4.2 add 'vendor/asset' to precompile list

To enable the precompilation of all non.js/.css assets within vendor/assets just add this to config/initializers/assets.rb:

Rails.application.config.assets.precompile << Proc.new { |path, fn| fn =~ /vendor\/assets/ && !%w(.js .css).include?(File.extname(path)) }

Be aware that this will precompile ALL non .js/.css assets that you have there, some plugins or libraries might have .txt or other files around, and those would end up into your precompiled list also.

If you need to precompile images only, you could use this:

Rails.application.config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
@mrbongiolo
mrbongiolo / css-simple-progress-bar.md
Last active August 26, 2021 13:10
Super simple progress bar using CSS variables

The CSS:

.simpleBar {
  --barMax: 100;
  --barCurrent: 0;
  display: block;
  width: 100%;
  height: 20px;
@mrbongiolo
mrbongiolo / send_wrapped_2020_emails.rb
Last active December 4, 2020 13:54
Using u-case to process a json file
# frozen_string_literal: true
module StocksGames
class SendWrapped2020Emails < Micro::Case::Strict
attribute :file_path
def call!
parse_json
.then(apply(:group_by_user))
.then(apply(:collect_name_and_valid_wallets))
@mrbongiolo
mrbongiolo / OPERATION_README.md
Last active October 26, 2020 00:41
Ruby on Rails Operation

An operation using the module:

module Api
  module V1
    module Page
      class Update
        include Operation

        attr_reader :resource
@mrbongiolo
mrbongiolo / README.md
Created August 24, 2020 21:44
Micro::Case::Result rspec matchers
@mrbongiolo
mrbongiolo / index.slim.erb
Last active July 18, 2020 21:36
Categories Index Example
.d-flex.align-items-center.justify-content-space-between
h3
| Listando categorias
= button_to 'Nova Categoria', new_category_path, method: :get, class: 'btn btn-primary'
table.table.table-hover
thead
tr
th
| Descrição
@mrbongiolo
mrbongiolo / README.md
Last active November 18, 2019 15:03
coordinators and projects

Cria os scopes lá no model de Coordinator, assim fica mais fácil organizar. PS: não esqueça de testar isso, não tenho certeza se está funcionando corretamente, só escrevi diretamente aqui no gist.

scope :assigned_to_project, ->(id) { left_outer_joins(:project).where(projects: { id: id }) }
scope :without_projects, -> { assigned_to_project(nil) }
scope :without_projects_or_assigned_to_project, ->(id) { without_projects.or(assigned_to_project(id)) }

No teu controller pode fazer algo assim:

@mrbongiolo
mrbongiolo / install-postgresql-ubuntu-vagrant
Last active March 21, 2019 16:18
Install PostgreSQL 9.3 on a Ubuntu Precise VM (Vagrant)
# Add the public GPG key
wget -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Create a file with the repository address
echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main | sudo tee /etc/apt/sources.list.d/postgresql.list
# Remove any older postgresql installation you may have (ex:)
sudo apt-get remove postgresql-9.1 postgresql-contrib-9.1 postgresql-client-9.1
# Install the PostgreSQL
@mrbongiolo
mrbongiolo / instructions.md
Last active March 12, 2018 22:13
From Heroku to Digital Ocean (backed by Dokku 0.6.5)

dokku 0.6.5

DO Dashboard

Create a droplet (can be a basic $5 one) and add a SSH key.

On the Browser

Access the droplet ip and finish the basic Dokku setup, basically it's used to setup a domain and add the SSH key to the dokku user.