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
import * as ZXing from "html5-qrcode/third_party/zxing-js.umd" | |
export function performMonkeyPatches() { | |
console.log("Monkey patching") | |
// Monkey-patch based on https://github.com/zxing-js/library/pull/420/commits/7644e279df9fd2e754e044c25f450576d2878e45 | |
const oldFunc = ZXing.HTMLCanvasElementLuminanceSource.toGrayscaleBuffer; | |
let inverterToggle = true; | |
ZXing.HTMLCanvasElementLuminanceSource.toGrayscaleBuffer = function(imagebuffer, width, height) { | |
const grayscaleBuffer = oldFunc(imagebuffer, width, height); |
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
var GetDatabaseInfo = func(indata string) string { | |
// Do database stuff here | |
} | |
func TestRequest(t *testing.T) { | |
// Replace our database access function here | |
GetDatabaseInfo = func(indata string) { | |
return "testingresult" | |
} |
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
(define-syntax class | |
(syntax-rules (attr method this) | |
( | |
(class class-name | |
((attr attr-name initial-val) ...) | |
((method (meth-name meth-arg ...) body ...) ...)) | |
(define class-name | |
(let | |
( | |
(result (quote (lambda () |
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
(define-syntax oo-class | |
(syntax-rules (attr method this) | |
( | |
(oo-class class-name | |
((attr attr-name initial-val) ...) | |
((method (meth-name meth-arg ...) body ...) ...)) | |
(define class-name | |
(lambda () | |
(letrec | |
( |
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
let req = Stripe.paymentRequestWithMerchantIdentifier("HIDDEN") | |
req?.requiredBillingAddressFields = PKAddressField.PostalAddress | |
req?.requiredShippingAddressFields = PKAddressField.None | |
let summary = PKPaymentSummaryItem(label: "Total", amount: currentOrder!.total()) | |
req?.paymentSummaryItems = [summary] | |
req?.supportedNetworks = [PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa, PKPaymentNetworkDiscover] | |
let auth = PKPaymentAuthorizationViewController(paymentRequest: req!) | |
auth.delegate = self | |
self.presentViewController(auth, animated: true, completion: { | |
}) |