This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.ponzmild.aws | |
import com.amazonaws.services.simplesystemsmanagement.model.{GetParameterRequest} | |
import com.amazonaws.services.simplesystemsmanagement.{AWSSimpleSystemsManagement, AWSSimpleSystemsManagementClientBuilder} | |
import scala.util.{Failure, Success, Try} | |
/** | |
* Find value from AWS SSM ParameterStore | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"got yaaa!!!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For Rails, include this file within the initializers folder and ignore it or exclude it from Git | |
require 'binding_of_caller' | |
module Kernel | |
# 'bp' stands for binding.pry or break point | |
pry_alias = ENV['PRY_ALIAS'] || 'bp' | |
caller_level = 1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is the correlative of Gemfile and it's aim is to include gems that are note meant to be part of the project | |
# but only for development purposes and you don't want to include them in the project as dependencies. | |
# That's why Gemfile_dev and Gemfile_dev.lock must be git-ignored or git-excluded | |
# To use the gems specified in this file: | |
# 1. Create a "Gemfile_dev" file (at same level of "Gemfile") | |
# 2. Prepend "BUNDLE_GEMFILE=Gemfile_dev" before "bundle install" or "bundle exec rails c" and so forth. | |
# | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Open iTerm2 | |
2. Go to: Preferences -> Profile -> Profiles -> Advanced (tab) | |
3. In "Semantic History" select "Run command" and fill out with: | |
/Applications/RubyMine.app/Contents/MacOS/rubymine \5 --line 0\2 \1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
class << self | |
def strip_hash_values(hash) | |
hash.each { |_key, value| deep_strip!(value) } | |
end | |
def strip_array_values(array) | |
array.each { |value| deep_strip!(value) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this file to the config/initializers folder | |
# | |
# Use: | |
# class Entity < ActiveRecord::Base | |
# validates :vat_number, spanish_vat: true | |
# end | |
class SpanishVatValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
unless validate_vat(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ValidateSpanishVat | |
module ClassMethods | |
# Implements model level validator for Spanish's VAT number. | |
# Usage: | |
# | |
# Inside a model with a vat field, simply put | |
# | |
# validates_spanish_vat field_name | |
# | |
def validates_spanish_vat(*attr_names) |