Skip to content

Instantly share code, notes, and snippets.

View oscaroceguera's full-sized avatar
🏠
Working from home

Oscar E. Oceguera Bibriesca oscaroceguera

🏠
Working from home
View GitHub Profile
@oscaroceguera
oscaroceguera / swagger.json
Created January 18, 2022 18:23
soccer document
{
"openapi": "3.0.0",
"info": {
"version": "2.0.0",
"title": "API Rest Dynamodb example",
"description": "Api Rest example to show the use of dynamodb, and docker-compose",
"license": {
"name": "Juan Ignacio Paz",
"url": "http://www.jipnet.com.ar"
}
@oscaroceguera
oscaroceguera / setup.sh
Created January 18, 2022 00:52
setup sh
#!/bin/sh
cd /setup
# Wait just in case LocalStack delays the start
sleep 7s
# Create table in DynamoDB
aws dynamodb create-table --endpoint-url http://localstack:4569 --cli-input-json file://create-players.json
{
"players": [
{
"PutRequest": {
"Item": {
"mytype": {
"S": "player"
},
"myposition": {
"S": "defender"
@oscaroceguera
oscaroceguera / players-v3.json
Created January 18, 2022 00:50
players v3 data
{
"players": [
{
"PutRequest": {
"Item": {
"mytype": {
"S": "player"
},
"myposition": {
"S": "defender"
@oscaroceguera
oscaroceguera / players-v2.json
Created January 18, 2022 00:50
players v2 data
{
"players": [
{
"PutRequest": {
"Item": {
"mytype": {
"S": "player"
},
"myposition": {
"S": "defender"
@oscaroceguera
oscaroceguera / players-v1.json
Created January 18, 2022 00:49
players data
{
"players": [
{
"PutRequest": {
"Item": {
"mytype": {
"S": "player"
},
"myposition": {
"S": "forward"
@oscaroceguera
oscaroceguera / create-players.json
Created January 18, 2022 00:46
create players table for dynamoddb
{
"TableName": "players",
"AttributeDefinitions": [
{
"AttributeName": "mytype",
"AttributeType": "S"
},
{
"AttributeName": "myposition",
"AttributeType": "S"
function countSmileys(arr) {
let count = 0;
let validFace = [
":)",
";)",
":-)",
";-)",
":~)",
";~)",
":D",
function countSmileys(arr) {
let smiles = 0;
let eyes = [";", ":"];
let noses = ["-", "~"];
let mouth = [")", "D"];
for (let i = 0; i < arr.length; i++){
if (arr[i].length == 3){
if (((eyes.indexOf(arr[i][0]) != -1)) && (noses.indexOf(arr[i][1]) != -1) && (mouth.indexOf(arr[i][2]) != -1)){
smiles++;
}
// 1. Demonstrate all the different ways to iterate the below array
const myArray = [1, 2, 3, 4, 5, 6];
// 2. Demonstrate all the different ways to iterate the keys of
// the below object
const myObject = { x: 1, y: "hi" };
// 3. Repeat #2, demonstrate different ways to iterate
// the values of "myObject"