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
ec.order = ec.order || {}; | |
ec.order.extraFields = ec.order.extraFields || {}; | |
// A text input that asks a buyer how to sign the package | |
ec.order.extraFields.wrapping_box_signature = { | |
'title': 'How should we sign the package?', | |
'textPlaceholder': 'Package sign', | |
'type': 'text', | |
'tip': 'We will put a label on a box so the recipient knows who it is from', | |
'required': false, |
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
require 'openssl' | |
key = OpenSSL::PKey::RSA.new(2048) | |
p encrypted_string = key.public_encrypt('my plaintext string', OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING) | |
p decrypted_string = key.private_decrypt(encrypted_string, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING) |
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
# | |
# A: | |
# pubsub = PgPubSub.new('channelname') | |
# pubsub.subscribe do |data| | |
# puts "data: #{data} is coming!" | |
# end | |
# | |
# B: | |
# pubsub = PgPubSub.new('channelname') | |
# pubsub.publish("hello world") |
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 PolicyTest < ActiveSupport::TestCase | |
def assert_permissions(current_user, record, available_actions, permissions_hash = {}) | |
permissions_hash.each do |action, should_be_permitted| | |
if should_be_permitted | |
assert_permit current_user, record, action | |
else | |
refute_permit current_user, record, action | |
end | |
end |