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
def verify_response(response, response_signature) | |
public_key_pem = File.read(Rails.root.join('config', 'gcash-public-key2.pem')) | |
public_key = OpenSSL::PKey::RSA.new(public_key_pem) | |
signature_dest = Base64.strict_decode64(response_signature) | |
public_key.verify(OpenSSL::Digest::SHA256.new, signature_dest, response.to_json) | |
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
payload = { | |
"Request": { | |
"Product": { | |
"PrimaryCategory": "6614", | |
"Attributes": { | |
"name": "api create product test sample", | |
"short_description": "This is a nice product", | |
"brand": "Remark", | |
"model": "asdf", | |
"kid_years": "Kids (6-10yrs)" |
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
<% | |
adyen = Adyen::Client.new | |
adyen.env = :test | |
# for basic-auth based implementations | |
adyen.ws_user = ENV['ADYEN_MERCHANT_LOGIN'] | |
adyen.ws_password = ENV['ADYEN_MERCHANT_PASSWORD'] | |
response = adyen.checkout.payment_methods({ | |
amount: { |
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
Sample 1 | |
_click: function() { | |
if ($('#add-here').is(':empty')) | |
React.render(<Child />, $('#add-here')[0]); | |
else | |
React.unmountComponentAtNode($('#add-here')[0]); | |
}, | |
render: function() { | |
return( | |
<div> |
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 Shelf < ActiveRecord::Base | |
has_many :comics | |
has_many :books#, validate: -> {self.shelf_of == 'book'} | |
accepts_nested_attributes_for :comics | |
accepts_nested_attributes_for :books | |
# has a dropdown on view for shelf_of that could either be 'comic' or 'book | |
validates :shelf_of, inclusion: { within: %w(comic book) } | |
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
if (!settings.silent && !window.aysUnloadSet) { | |
window.aysUnloadSet = true; | |
$(window).bind('beforeunload', function() { | |
$dirtyForms = $("form").filter('.' + settings.dirtyClass); | |
if ($dirtyForms.length == 0) { | |
return; | |
} | |
// Prevent multiple prompts - seen on Chrome and IE | |
if (navigator.userAgent.toLowerCase().match(/msie|chrome/)) { | |
if (window.aysHasPrompted) { |
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
filepicker.pickMultiple picker_options, (pick_fpfiles) -> | |
for pick_fpfile, i in pick_fpfiles | |
sanitized_filename = sanitize_filename(pick_fpfile.filename) | |
console.log 'Sending file...' | |
console.log pick_fpfile | |
filepicker.store pick_fpfile, store_options, (store_fpfile) -> | |
console.log 'Callback of file...' | |
console.log pick_fpfile |
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
filepicker.pickMultiple picker_options, (pick_fpfiles) -> | |
for pick_fpfile, i in pick_fpfiles | |
sanitized_filename = sanitize_filename(pick_fpfile.filename) | |
filepicker.store pick_fpfile, store_options, (store_fpfile) -> | |
# Remove files from both fp.io and our root s3 path | |
# Here's where the problem happens. pick_fpfile is always the last from the list of pick_fpfiles since filepicker.store is asynchronous and pick_fpfile has already changed by the time the filepicker.remove's success callback has returned | |
filepicker.remove pick_fpfile, {policy: security.policy, signature: security.signature} |
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
filepicker.pick picker_options, (pick_fpfile) -> | |
sanitized_filename = sanitize_filename(pick_fpfile.filename) | |
filepicker.store pick_fpfile, store_options, (store_fpfile) -> | |
# Remove files from both fp.io and our root s3 path | |
filepicker.remove pick_fpfile, {policy: security.policy, signature: security.signature} |
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
$('ul.links').on 'ajax:success', '.link', (evt, data, status, xhr) -> | |
console.log 'link clicked' | |
console.log $(this) | |
$('#this-form').bind 'ajax:success', (evt, data, status, xhr) -> | |
console.log 'form submitted' | |
# # When .link is clicked | |
# link clicked | |
# [a.link ...] |
NewerOlder