Skip to content

Instantly share code, notes, and snippets.

View nilocoelhojunior's full-sized avatar

Nilo nilocoelhojunior

  • Teresina, Piauí
View GitHub Profile
@nilocoelhojunior
nilocoelhojunior / nuxt-breadcrumb.js
Created November 7, 2019 20:37
Breadcrumb to Nuxtjs
<template>
<ol class="breadcrumb">
<li class="item">
<nuxt-link :to="'/'" class="title">
Home
</nuxt-link>
</li>
<li v-for="(item, i) in crumbs" :key="i" class="item">
<nuxt-link :to="item.to" class="title">
{{ item.title }}
@nilocoelhojunior
nilocoelhojunior / active_storage.rb
Created April 12, 2019 14:33 — forked from TakuyaHarayama/active_storage.rb
Add acl and cache_control to ActiveStorage gcs
# config/initializers/active_storage.rb
Rails.application.config.to_prepare do
# Provides the class-level DSL for declaring that an Active Record model has attached blobs.
ActiveStorage::Attached::Macros.module_eval do
def has_one_attached(name, dependent: :purge_later, acl: :private)
class_eval <<-CODE, __FILE__, __LINE__ + 1
def #{name}
@active_storage_attached_#{name} ||= ActiveStorage::Attached::One.new("#{name}", self, dependent: #{dependent == :purge_later ? ":purge_later" : "false"}, acl: "#{acl}")
end
def #{name}=(attachable)
### To Fixe
* docker stop CONTAINER_ID permission denied
* ERROR: unable to insert jump to DOCKER-ISOLATION rule in FORWARD chain: (iptables failed: iptables --wait -I FORWARD -j DOCKER-ISOLATION: iptables v1.6.0: Couldn't load target `DOCKER-ISOLATION':No such file or directory
`sudo systemctl restart docker` or `sudo service docker restart`
@nilocoelhojunior
nilocoelhojunior / file_uploader.rb
Created January 31, 2018 01:29
Carrierwave Fog rename file
class FileUploader < CarrierWave::Uploader::Base
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def extension_white_list
%w(pdf)
end
@nilocoelhojunior
nilocoelhojunior / gist:9034882
Created February 16, 2014 14:14
Disqus Wordpress
<?php comments_template(); ?>