Skip to content

Instantly share code, notes, and snippets.

Avatar

Vernon de Goede vernondegoede

View GitHub Profile
View npm-audit.log
=== npm audit security report ===
# Run npm update lodash --depth 10 to resolve 132 vulnerabilities
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High │ Prototype Pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ babel-core [dev] │
View gist:2945c4b040ba989f62067ae5ed2f6e46
warning There appears to be trouble with our server. Retrying...
warning There appears to be trouble with our server. Retrying...
warning There appears to be trouble with our server. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-9.0.1.tgz: Request failed \"503 Service Unavailable\"".
info If you think this is a bug, please open a bug report with the information provided in "/opt/atlassian/pipelines/agent/build/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
View gist:659e16abcea7912c1999de79f86c9f7e
[
'{{repeat(50)}}',
{
id: 'cus_{{objectId()}}',
name: '{{firstName()}} {{surname()}}',
company: '{{company()}}',
email: '{{email()}}',
picture: {
large: 'https://randomuser.me/api/portraits/{{gender()}}/{{index(1)}}.jpg',
medium: 'https://randomuser.me/api/portraits/med/{{gender()}}/{{index(1)}}.jpg',
@vernondegoede
vernondegoede / app.json
Created Jul 15, 2019
NSFaceIDUsageDescription error
View app.json
{
"expo": {
"name": "xxx",
"slug": "xxx",
"privacy": "public",
"sdkVersion": "33.0.0",
"platforms": ["ios"],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
View index.js
const apiKey = "test_xxx";
const mollie = require("@mollie/api-client")({ apiKey });
const MANDATE_STATUS_VALID = "valid";
const retrieveCustomerMandates = customerId =>
mollie.customers_mandates.all({ customerId });
const customerHasValidMandates = customerId => {
return new Promise((resolve, reject) => {
View blah.js
~/Sites/typescript-api-node/examples/customers typescript*
node list
{ Error: Request failed with status code 401
at createError (/Users/vernon/Sites/typescript-api-node/node_modules/axios/lib/core/createError.js:16:15)
at settle (/Users/vernon/Sites/typescript-api-node/node_modules/axios/lib/core/settle.js:18:12)
at IncomingMessage.handleStreamEnd (/Users/vernon/Sites/typescript-api-node/node_modules/axios/lib/adapters/http.js:201:11)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
@vernondegoede
vernondegoede / shipments.js
Created Nov 21, 2018
Shipments tracking code validation fix
View shipments.js
/* app/assets/javascripts/spree/backend/shipments.js */
/* global shipments, variantStockTemplate, order_number */
// Shipments AJAX API
$(document).ready(function () {
'use strict'
// handle variant selection, show stock level.
$('#add_variant_id').change(function () {
var variantId = $(this).val()
@vernondegoede
vernondegoede / transition_order_state.sh
Created Mar 21, 2018
Add payment details to order and transition order state to complete
View transition_order_state.sh
curl -X "PUT" "/api/v1/checkouts/R597974478" \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'X-Spree-Token: 0123456789' \
-d $'{
"order": {
"payments_attributes": [
{
"payment_method_id": "1"
}
]
@vernondegoede
vernondegoede / payment_decorator.rb
Created Mar 20, 2018
Create a Mollie transaction, even when the order is completed (but not paid for).
View payment_decorator.rb
Spree::Payment.class_eval do
delegate :transaction_id, to: :source
def build_source
return unless new_record?
if source_attributes.present? && source.blank? && payment_method.try(:payment_source_class)
self.source = payment_method.payment_source_class.new(source_attributes)
source.payment_method_id = payment_method.id
source.user_id = order.user_id if order
View checkout_controller_decorator.rb
module Spree
module CheckoutWithMollie
def update
if payment_params_valid? && paying_with_mollie?
if @order.update_from_params(params, permitted_checkout_attributes, request.headers.env)
payment = @order.payments.last
payment.process!
mollie_payment_url = payment.payment_source.payment_url
MollieLogger.debug("For order #{@order.number} redirect user to payment URL: #{mollie_payment_url}")
You can’t perform that action at this time.