Skip to content

Instantly share code, notes, and snippets.

View nicoespeon's full-sized avatar

Nicolas Carlo nicoespeon

View GitHub Profile
@nicoespeon
nicoespeon / creating-the-dropin.js
Created August 12, 2020 19:29
Params we use to instantiate the DropIn
const checkout = new AdyenCheckout({
"locale": "en",
"originKey": "...",
"environment": "test",
"translations": {
"en": {
"creditCard.holderName.invalid": "Oops! Something Went Wrong",
"creditCard.numberField.title": "Card Number",
"creditCard.numberField.placeholder": "•••• •••• •••• ••••",
"creditCard.numberField.invalid": "Oops! Something Went Wrong",
@nicoespeon
nicoespeon / body.json
Created August 12, 2020 19:12
Request / response of /paymentMethods
{
"amount": { "currency": "USD", "value": 5160 },
"channel": "Web",
"countryCode": "US",
"merchantAccount": "BusbudUSA",
"shopperLocale": "en-us",
"shopperReference": 1
}
@nicoespeon
nicoespeon / index.ts
Created April 25, 2020 22:23
Trying to get inferred type of an identifier with @typescript/vfs
import {
createDefaultMapFromNodeModules,
createSystem,
createVirtualTypeScriptEnvironment,
} from "@typescript/vfs";
import * as ts from "typescript";
const fsMap = createDefaultMapFromNodeModules({
target: ts.ScriptTarget.ES2015,
});
@nicoespeon
nicoespeon / result.csv
Last active July 5, 2019 19:32
Pubweb Social Analysis
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"contributor";"path";"size"
"Benoit Zohar";"modules/checkout/";19690
"Michael Vial";"modules/results/";13207
"Victor Mus";"modules/search/";6587
"Nicolas Carlo";"modules/route/";5485
"Benoit Zohar";"modules/purchase/";5121
"Nicole Ho";"modules/purchase-confirmation/";4936
"Nicolas Carlo";"modules/partner/";4606
"Nicole Ho";"modules/header/";4437
"Benoit Zohar";"modules/help/";4319
@nicoespeon
nicoespeon / category_pagination.rb
Last active April 27, 2017 20:45
Per category pagination Jekyll 1.5.1
# Per-category pagination. Useful for multilingual blogs =)
# It will react, regarding your configuration in `config.yml`:
#
# paginate_per_category: true|false - activate this pagination or keep the
# default one
# default_category: "en" - determine the default category if you
# wish the root pagination to be this one
module Jekyll
module Generators
class Pagination < Generator
@nicoespeon
nicoespeon / observables-second-shot.js
Last active March 23, 2017 14:16
Blog - Using Observables to make our app work with barcode scanners
const MAX_INTERVAL_BETWEEN_EVENTS_IN_MS = 50
const keyCode$ = Rx.Observable.fromEvent(document, "keypress")
.pluck('keyCode')
const keyCodesBuffer$ = keyCode$
// --(43)-(64)----(32)-----(65)-(77)-(13)--->
.buffer(keyCode$.debounce(MAX_INTERVAL_BETWEEN_EVENTS_IN_MS))
// --([43,64])----([32])-----([65,77,13])--->
@nicoespeon
nicoespeon / observables-third-shot.js
Last active March 23, 2017 14:16
Blog - Using Observables to make our app work with barcode scanners
const ENTER_KEY_CODE = 13
const MAX_INTERVAL_BETWEEN_EVENTS_IN_MS = 50
const keyCode$ = Rx.Observable.fromEvent(document, "keypress")
.pluck('keyCode')
const keyCodesBuffer$ = keyCode$
.buffer(keyCode$.debounce(MAX_INTERVAL_BETWEEN_EVENTS_IN_MS))
.filter(isFromScan)
@nicoespeon
nicoespeon / observables-fourth-shot.js
Last active March 23, 2017 14:16
Blog - Using Observables to make our app work with barcode scanners
const ENTER_KEY_CODE = 13
const MAX_INTERVAL_BETWEEN_EVENTS_IN_MS = 50
const keyCode$ = Rx.Observable.fromEvent(document, "keypress")
.pluck('keyCode')
const keyCodesBuffer$ = keyCode$
.buffer(keyCode$.debounce(MAX_INTERVAL_BETWEEN_EVENTS_IN_MS))
.filter(isFromScan)
@nicoespeon
nicoespeon / observables-first-shot.js
Last active March 22, 2017 08:07
Blog - Using Observables to make our app work with barcode scanners
const keyCode$ = Rx.Observable.fromEvent(document, "keypress")
// ---(ev)--(ev)--------(ev)--->
.pluck('keyCode')
// ---(43)--(51)--------(13)--->
@nicoespeon
nicoespeon / imperative-first-shot.js
Last active March 21, 2017 08:39
Blog - Using Observables to make our app work with barcode scanners
const ENTER_KEY_CODE = 13
let keyCodesBuffer = []
document.addEventListener("keypress", (event) => {
const keyCode = event.keyCode
if(keyCode === ENTER_KEY_CODE) {
fillInputWithKeyCodesBuffer()
cleanBuffer()
} else {