Skip to content

Instantly share code, notes, and snippets.

View Wendersonandes's full-sized avatar

Wenderson Fernandes Wendersonandes

  • Emerge
  • Belo Horizonte, Brazil
View GitHub Profile
@pixeldevsio
pixeldevsio / HumanMade S3 Digital Ocean Instructions
Last active May 2, 2024 06:57
Use HumanMade S3 plugin with Digital Ocean Spaces
These are the two steps you need to take to get S3 to work with Digital Ocean Spaces.
https://github.com/humanmade/S3-Uploads
@blocknotes
blocknotes / setup.md
Last active February 27, 2024 07:11
ActiveAdmin Trix editor setup (tested with Rails 6.0.3.3)
  • Setup the Rails project with ActiveAdmin using Webpacker: rails g active_admin:install --use_webpacker
  • Setup Trix editor for ActiveAdmin:
    • Execute: bin/rails action_text:install
    • Add Javascript library to app/javascript/packs/active_admin.js:
require("trix")
require("@rails/actiontext")
  • Add style library to app/javascript/stylesheets/active_admin.scss:
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@rjekic
rjekic / wp.sh
Last active June 16, 2022 12:18 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script using wp-cli
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
# Gathering database login credentials from user input
read -p "Database Host: " dbhost
read -p "Database Name: " dbname
read -p "Database User: " dbuser
@tbcooney
tbcooney / business_hours.rb
Created August 21, 2019 04:07
Serialization TimeOfDay with Rails and jsonb
#!/usr/bin/env ruby
# Supplies TimeOfDay class that includes parsing, strftime, comparison, and arithmetic
gem 'tod', '~> 2.2'
ActiveRecord::Schema.define do
add_column :businesses, :force => true do |t|
t.jsonb :business_hours
end
end
@aurelioluiz
aurelioluiz / dokku-digitalocean.md
Last active June 1, 2024 11:28
Aplicação Rails com Dokku na DigitalOcean

Aplicação Rails com Dokku na DigitalOcean

Etapas para configuração de uma aplicação em Rails na DigitalOcean usando o Dokku para deploy. A documentação completa está disponível em http://dokku.viewdocs.io/dokku/getting-started/installation

Requisitos

  • DigitalOcean droplet Ubuntu 18.04
  • Dokku 1-click installation
  • Aplicação Rails no GitHub

Criando usuário deploy

Acesse o droplet como root

@zulhfreelancer
zulhfreelancer / fix-bundle-install-network-error.md
Last active October 30, 2023 05:34
How to fix bundle install 'network error while fetching' issue on Mac OSX?

If you get something like this when running bundle install...

Network error while fetching https://rubygems.org/quick/Marshal.4.8/xxx-x.x.x.gemspec.rz (execution expired)

...this solution might work for you.

First, make sure you have tried all the troubleshoot solutions here.

@henriqueutsch
henriqueutsch / Gemfile
Last active August 22, 2018 12:46
Migrar posts medium rotinas
source 'https://rubygems.org'
gem 'string-similarity'
gem 'activesupport'
gem 'nokogiri'
gem "awesome_print"
gem 'colorize'
@mmalek-sa
mmalek-sa / string_enums.rb
Created August 16, 2018 20:45
String enums are useful when you want to keep the actual string instead of integer in database, This gist add the validation to make sure users are passing correct values to model.
require 'active_support/concern'
module StringEnums
extend ActiveSupport::Concern
class_methods do
def string_enum(enums_hash)
enum_name = enums_hash.keys.first.to_s
define_singleton_method(enum_name.pluralize) do
@kylephillips
kylephillips / nested-pages-hide-add-multiple.php
Created June 27, 2018 14:02
Hide the "Add Multiple" buttons from non-administrators in Nested Pages
/**
* Place in your theme's functions.php
*/
add_action('admin_head', 'hide_nested_pages_add_multiple');
function hide_nested_pages_add_multiple()
{
$user = wp_get_current_user();
$allowed_roles = ['administrator'];
if ( array_intersect($allowed_roles, $user->roles) ) return;
echo '<style>.open-bulk-modal, .nestedpages .action-buttons .nestedpages-dropdown ul li a.add-new-child, .nestedpages .action-buttons .nestedpages-dropdown ul li:nth-child(2) {display:none;}</style>';