Skip to content

Instantly share code, notes, and snippets.

@JNajera
JNajera / docker_export.sh
Last active August 25, 2020 21:08
Docker Expoert and Import DB Mysql
# Backup
docker exec $(docker ps | grep "mysql" | awk '$6 >= 8 {print $1}') /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
@JNajera
JNajera / Gemfile
Created June 26, 2020 14:40 — forked from dhh/Gemfile
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
@JNajera
JNajera / cloudSettings
Last active December 13, 2019 16:03
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-06-11T02:49:18.180Z","extensionVersion":"v3.2.9"}
https://www.pivotaltracker.com/help/api?version=v3#github_hooks
https://www.pivotaltracker.com/help/api?version=v3#scm_post_commit_message_syntax
SCM Post-Commit Message Syntax
To associate an SCM commit with a specific Tracker story, you must include a special syntax in the commit message to indicate one or more story IDs and (optionally) a state change for the story. Your commit message should have square brackets containing a hash mark followed by the story ID. If a story was not already started (it was in the "not started" state), a commit message will automatically start it. For example, if Scotty uses the following message when committing SCM revision 54321:
[#12345677 #12345678] Diverting power from warp drive to torpedoes.
@JNajera
JNajera / s3buckets_delete.rb
Created October 29, 2013 20:56
Delete all Amazon S3 buckets in console.
require "rubygems" # optional
require "aws/s3"
AWS::S3::Base.establish_connection!(
:access_key_id => 'INSERT_ACCESES_KEY_ID',
:secret_access_key => 'INSERT_SECRET_ACCESES_KEY')
buckets = AWS::S3::Service.buckets
puts 'Start deleting buckets...'
SELECT
SUM(pgClass.reltuples) AS totalRowCount
FROM
pg_class pgClass
LEFT JOIN
pg_namespace pgNamespace ON (pgNamespace.oid = pgClass.relnamespace)
WHERE
pgNamespace.nspname NOT IN ('pg_catalog', 'information_schema') AND
pgClass.relkind='r'
@JNajera
JNajera / On console
Created August 15, 2013 22:47
Add refinerycms-page-images to a custom engine of RefineryCMS
rails g refinery:engine products title:string description:text
<!-- Locale switchers, but presents all available locales as options, even the presently active one -->
<ul>
<% Refinery::I18n.config.frontend_locales.each do |locale| %>
<li>
<%= link_to "/#{locale.to_s + request.path}", {:title => Refinery::I18n.locales[locale]} do%>
<span><%= Refinery::I18n.locales[locale] %></span>
<% end -%>
</li>
<% end %>
When starting a project that includes refinerycms-blog:
$ rake refinery:override view=refinery/pages/*
$ rake refinery:override view=layouts/*
$ rake refinery:override view=refinery/blog/shared/*
$ rake refinery:override view=refinery/blog/posts/*
$ rake refinery:override view=refinery/*
$ rake refinery:override controller=refinery/blog/*
$ rake refinery:override controller=refinery/*
rails generate refinery:engine product title:string description:text image:image --i18n title description