This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getTree = barcode => { | |
const barcodeLength = barcode.length; | |
const firstTwoDigits = parseInt(barcode.slice(0,2)); | |
const dic = { | |
'bluecypress': {digits: [45,56], length: 8, name: 'Blue Ice Arizona Cypress'}, | |
'palm': {digits: [76, 43], length: 12, name: 'The Palm Tree'}, | |
'maple': {digits: [23, 12,45,54], length: 6, name: 'Maple Trees'} | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from 'aws-cdk-lib'; | |
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; | |
import * as apigateway from 'aws-cdk-lib/aws-apigateway'; | |
import * as lambda from 'aws-cdk-lib/aws-lambda'; | |
import * as appsync from 'aws-cdk-lib/aws-appsync'; | |
import * as iam from 'aws-cdk-lib/aws-iam'; | |
const { Stack, App, RemovalPolicy } = cdk; | |
class GraphQLAPIStack extends Stack { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { graphql, buildSchema } = require('graphql'); | |
const { makeExecutableSchema } = require('graphql-tools'); | |
const AWS = require('aws-sdk'); | |
// Set up AWS DynamoDB | |
const dynamodb = new AWS.DynamoDB.DocumentClient(); | |
const tableName = 'Items'; // Your DynamoDB table name | |
// Define your GraphQL schema | |
const typeDefs = ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fastify = require('fastify')({ logger: true }); | |
const mysql = require('fastify-mysql'); | |
const Joi = require('joi'); // For request validation | |
// Register the fastify-mysql plugin and set up the database connection with a connection pool | |
fastify.register(mysql, { | |
connectionString: 'mysql://your_username:your_password@your_database_url/your_database_name', | |
pool: { | |
min: 0, | |
max: 10, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.json-skin { font-family: monospace,'Courier'; } | |
.json-skin ul { padding-left: 0; display: inline; list-style: none; } | |
.json-skin .elm-arbol { display: inline; } | |
.json-skin li { padding-left: 20px; } | |
.json-skin ul.elm-object::before { content: '{'; font-weight: bold; } | |
.json-skin ul.elm-object::after { content: '}'; font-weight: bold; } | |
.json-skin ul.elm-array::before { content: '['; font-weight: bold; } | |
.json-skin ul.elm-array::after { content: ']'; font-weight: bold; } | |
.json-skin span.elm-more {cursor: pointer; } | |
.json-skin span.elm-more::before { content: '...'; font-weight: bold; color: gray; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const require = (url) => { | |
const head = document.getElementsByTagName('head')[0]; | |
const script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = url; | |
head.appendChild(script); | |
} | |
require("https://cdn.jsdelivr.net/npm/hyperformula/dist/hyperformula.full.min.js"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myFunc = () => { | |
var mensaje='hello World!'; | |
console.log(mensaje); | |
}; | |
//Can be also expressed as: | |
/* | |
function myFunc() { | |
var mensaje='hello World!'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const npm = async moduleName => { | |
console.log('Fetching ' + moduleName + '... just one second'); | |
let res = await fetch('https://cdn.jsdelivr.net/npm/' + moduleName + '@latest'); | |
let bd = await res.text(); | |
console.log(bd); | |
}; | |
// npm('lodash'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set runtimepath^=~/.vim/bundle/ctrlp.vim | |
source ~/.vim/vundle | |
execute pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
set background=dark | |
colorscheme solarized |
NewerOlder