Skip to content

Instantly share code, notes, and snippets.


andersen_fan as181920

  • vcooline
  • shanghai
View GitHub Profile
View ec.order.extra_fields.spec.js
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,
as181920 / encryption-decryption.rb
Created Apr 20, 2018 — forked from gevans/encryption-decryption.rb
A couple examples of using asymmetric RSA signing and encryption using Ruby's OpenSSL libraries.
View encryption-decryption.rb
require 'openssl'
key =
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)
View test
### Keybase proof
I hereby claim:
* I am as181920 on github.
* I am as181920 ( on keybase.
* I have a public key ASDbdqRnMVMIsViFMyPTTbravR8ZdwwHdLZyEyBiI0uK5go
To claim this, I am signing this object:
as181920 / pg_pub_sub.rb
Created May 24, 2017 — forked from chsh/pg_pub_sub.rb
PostgreSQL LISTEN/NOTIFY example for ruby
View pg_pub_sub.rb
# A:
# pubsub ='channelname')
# pubsub.subscribe do |data|
# puts "data: #{data} is coming!"
# end
# B:
# pubsub ='channelname')
# pubsub.publish("hello world")
View test_helper.rb
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
refute_permit current_user, record, action