Skip to content

Instantly share code, notes, and snippets.

View yeisoncruz16's full-sized avatar
😄
Work harder than you did yesterday

Yeison Cruz yeisoncruz16

😄
Work harder than you did yesterday
View GitHub Profile
@yeisoncruz16
yeisoncruz16 / commit-msg.sh
Created September 22, 2020 15:43
simple commit message hook to validate message contain :
#!/bin/bash
MSG="$1"
message="Hey! looks like your commit message is not following correct format"
if ! grep -qE ":" "$MSG";
then
printf "\n";
echo -e "\e[91m${message}\e[0m";
echo "Your commit message: " && cat "${MSG}";
@yeisoncruz16
yeisoncruz16 / async-foreach.js
Last active April 27, 2021 20:45
Simple asynchronous ForEach integration for Javascript without async/await or libraries.
function forEachOf(items, callback, finishCallback) {
if (items.length !== undefined && items.length > 0) {
this.key = this.key || 0;
if (this.key >= items.length){
this.key = 0;
finishCallback();
}else {
callback(items[this.key], this.key, () => {
this.key++;
forEachOf(items, callback, finishCallback);
@yeisoncruz16
yeisoncruz16 / .gitlab-ci.yml
Last active October 9, 2020 16:11
Simple Gitlab CI, deploy AWS Lambda using Serverless framework
image: node:latest
stages:
- deploy
Production:
stage: deploy
only:
refs:
- master
before_script:
@yeisoncruz16
yeisoncruz16 / template.yaml
Created August 20, 2020 14:13
Cloudformation template to create Lambda, SQS, role, Policy, Api
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
Lambda, SQS, role, Policy, Api
Globals:
Function:
Timeout: 5
Runtime: python3.6
Handler: app.lambda_handler
@yeisoncruz16
yeisoncruz16 / Chain-of-Responsibility-Pattern.js
Last active August 20, 2020 14:14
Simple chain of responsibility pattern implemented using Javascript ES6
class BaseDesign {
setNext(next){
this._next = next;
}
next(role){
if(this._next){
return this._next.run(role);
}