Skip to content

Instantly share code, notes, and snippets.

View sebelga's full-sized avatar
:octocat:
#hello

Sébastien Loix sebelga

:octocat:
#hello
View GitHub Profile
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { RecursiveReadonly } from '@kbn/utility-types';
import { BehaviorSubject, Observable } from 'rxjs';
interface ScriptDefinition {
    ... // ?? to be defined
    __meta__: {
        version: number; // this lets the editor know how to handle the def
    }
}
@sebelga
sebelga / .gitlab-ci.yml
Created November 3, 2020 08:49 — forked from balintsera/.gitlab-ci.yml
Gitlab config for docker based CICD pipeline (node.js)
image: customregistry/docker-builder:latest
variables:
dockerTag: '$CI_BUILD_REF'
DOCKER_REPO: customregistry
IMAGE_BASE_NAME: redis-faas
IMAGE: $EVISTA_DOCKER_REPO/$IMAGE_BASE_NAME:$CI_BUILD_REF
CONTAINER_NAME: 'fotok-redis-pipeline'
TARGET_DIR_STAGE: /srv/docker/staging/redis-faas
TARGET_DIR_PROD: /srv/docker/prod/redis-faas
@sebelga
sebelga / es-local-remote-cluster.md
Last active December 4, 2018 14:17
Configure and launch a local Elasticsearch Remote Cluster (for development)

Setup

You'll need to build from source. For that we will use gradle (https://gradle.org/).

Prerequisite

Make sure that your JAVA_HOME environment variable is set by running:

$ echo $JAVA_HOME
// ./middleware/billing.js
const billingApi = require('your-billing-package');
/**
* Dont' allow payment below 1$
*/
function validateAmount(amount, source, description, currency) {
if (amount < 1) {
return Promise.reject('Payement not allowed. The minimum charge is 1.00$.');
// your-billing-package
const stripe = require('stripe')('sk_test_token');
const hooks = require('promised-hooks');
const { notify } = require('some-notification-package');
async function processPayement(amount, source, description, currency) {
return new Promise((resolve, reject) => {
let charge;
const stripe = require('./vendors/stripe');
// No changes on the processPayement
async function processPayement(amount, source, description) {
let charge;
try {
charge = await stripe.charges.create({
amount,
source,
description,
// ./vendors/stripe.js
const stripe = require('stripe')('sk_test_your-token');
const hooks = require('promised-hooks');
// Add Hooks functionalities to the "stripe.charges" methods
hooks.wrap(stripe.charges);
// Add a "pre" middleware
stripe.charges.pre('create', function preCharge({ amount, source, description, currency }) {
const stripe = require('stripe')('sk_test_your-token');
const hooks = require('promised-hooks');
// Add Hooks functionalities to the "stripe.charges" methods
hooks.wrap(stripe.charges);
// Add a "pre" middleware
stripe.charges.pre('create', function preCharge({ amount, source, description, currency }) {
// All the arguments passed to the charges.create() method are available
const stripe = require('stripe')('sk_test_your-token');
async function processPayement(amount, source, description) {
let charge;
try {
charge = await stripe.charges.create({
amount,
source,
description,
currency: "usd"