Skip to content

Instantly share code, notes, and snippets.

View damiancipolat's full-sized avatar
💭
Creating amazing things!

DamCipolat damiancipolat

💭
Creating amazing things!
View GitHub Profile
@damiancipolat
damiancipolat / aws-rekognition-decode-image64.js
Created May 14, 2020 14:35
Aws rekognition lambda - read image from encoded image using base64
const AWS = require('aws-sdk');
const rekognition = new AWS.Rekognition();
//Analyze image.
const analyzeImg = (image) => rekognition.detectFaces(image).promise();
//Decode image.
const decodeImage = (image64)=>{
return {
@damiancipolat
damiancipolat / busyWait.js
Created May 26, 2020 04:44
Make a busy wait in JS
/**
* Create a sleep function using promise.
* @param {number} ms - duration time in milliseconds.
*/
const sleep = (ms) => new Promise(resolve => setTimeout(()=>resolve({time:ms}), ms));
/**
* Loop until have the success condition.
* @param {function} condition - boolean function that return the condition.
* @param {number} timeout - limit execution time.
@damiancipolat
damiancipolat / busyWait.js
Created May 26, 2020 04:44
Make a busy wait in JS
/**
* Create a sleep function using promise.
* @param {number} ms - duration time in milliseconds.
*/
const sleep = (ms) => new Promise(resolve => setTimeout(()=>resolve({time:ms}), ms));
/**
* Loop until have the success condition.
* @param {function} condition - boolean function that return the condition.
* @param {number} timeout - limit execution time.
import 'dart:convert';
void main(){
var nombre = 'Damian';
var empresa = 'My drugs';
int precio = 100;
double pi = 3.141592;
bool activado = true;
stages:
- test
- build
- deploy
- notify
run_test:
stage: test
image: node:10.16.0-alpine
script:
@damiancipolat
damiancipolat / my_flutter_ci_Cd.yml
Last active August 5, 2020 01:38
An example of create a flutte CICD using gitlabCI
stages:
- test
- build
- deploy
- notify
run_test:
stage: test
image: cirrusci/flutter:stable
script:
@damiancipolat
damiancipolat / docker-compose.yml
Created August 20, 2020 03:58
Example of docker compose of many nodejs containers
version: "2"
services:
home:
container_name: home-service
restart: always
build: ./home-service
ports:
- "172.24.0.1:5000:8080"
clients:
container_name: clients-service
@damiancipolat
damiancipolat / calculate_cuil.js
Created September 10, 2020 18:50
Codigo JS para calcular el CUIL en base al DNI y sexo, pensado para ser usado en NODE.JS
const assert = require('assert');
const createError = require('http-errors');
/*
Receive a dni and gender 'M' or 'F' and return his cuil.
Params
document : number -> dni
gender : string
Returns
string -> cuil
*/
@damiancipolat
damiancipolat / lambda_email_registration_endpoint.js
Created September 23, 2020 02:32
This is a lambda to handle an api beta tester landing registration in a table.
const AWS = require('aws-sdk');
//Define aws region
AWS.config.update({
region:'us-east-1'
});
const TABLE = 'landing_page_emails';
@damiancipolat
damiancipolat / joi_client_schema.js
Created September 23, 2020 06:05
An example of a full client schema validation
const Joi = require('joi');
//Schemas.
const googleSchema = Joi.object({
avatar:Joi.string().uri(),
email:Joi.string().email(),
name:Joi.string()
});
const blockedSchema = Joi.object({