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 { Logger } from "@aws-lambda-powertools/logger"; | |
import { SESClient, SendRawEmailCommand } from "@aws-sdk/client-ses"; | |
import MailComposer from 'nodemailer/lib/mail-composer/index.js'; | |
type RawEmailCommandInput = { | |
from: string; | |
to: string; | |
subject: string; | |
text?: string; |
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 { AmplifyAuth } from '@aws-amplify/auth-construct-alpha'; | |
import { AmplifyData, AmplifyDataDefinition } from '@aws-amplify/data-construct'; | |
import { NodejsFunction, NodejsFunctionProps } from 'aws-cdk-lib/aws-lambda-nodejs'; | |
import { aws_lambda }from 'aws-cdk-lib'; | |
import * as cdk from 'aws-cdk-lib'; | |
import { UserPool } from 'aws-cdk-lib/aws-cognito'; | |
import { Construct } from 'constructs'; | |
import { DynamoEventSource, DynamoEventSourceProps } from 'aws-cdk-lib/aws-lambda-event-sources'; | |
type LambdaTriggerToDynamoProps = { |
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 jsdom from 'jsdom'; | |
const originalHTML = '<html><head></head><body><oembed url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"></oembed><p>Some text.</p><oembed url="https://vimeo.com/123456789"></oembed></body></html>'; | |
const dom = new jsdom.JSDOM(originalHTML, { contentType: 'text/html' }); | |
const document = dom.window.document; | |
const oembeds = document.querySelectorAll('oembed'); | |
const promises = Array.from(embeds).map(async () => { | |
const url = element.attributes.url.value; | |
const contentResponse = await fetch(`https://oembed.ameliarueda.com/oembed?url=${url}`); |
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
<html> | |
<head> | |
<title>Iframely Experiment</title> | |
</head> | |
<body> | |
<h1>Iframely Experiment</h1> | |
<div> | |
<figure class="media"> | |
<oembed url="https://twitter.com/ice_panel/status/1668998855969628176"></oembed> | |
</figure> |
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 type { Construct } from "constructs"; | |
import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs"; | |
import { RemovalPolicy } from 'aws-cdk-lib'; | |
import { RetentionDays } from 'aws-cdk-lib/aws-logs'; | |
import { Alias, Runtime } from 'aws-cdk-lib/aws-lambda'; | |
import { | |
HttpApi, HttpMethod, | |
} from '@aws-cdk/aws-apigatewayv2-alpha'; | |
import { HttpLambdaIntegration, HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; |
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
function getOrdersById(id: number) { | |
console.time('NewPrismaClient'); | |
const prisma = new PrismaClient(); | |
console.timeEnd('NewPrismaClient'); | |
console.time('OrmQuery'); | |
await prisma.tb_orders.findMany({ | |
where: { | |
orderId: id, | |
}, | |
}); |
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
let str = "Hello__helloWorld__minor" | |
str = str.replace(/_/g, ' ').trim() // remove underscore | |
str = str.replace(/([A-Z])/g, ' $1') // add spaces before uppercase | |
str = str.replace(/ +/g, ' '); // remove double space | |
str = str.replace(/(\b\S+\b)(?=.*\1)/ig, '') // remove duplicate words https://stackoverflow.com/a/46364625 | |
console.log(str.trim()) |
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 { FrontEndRequest } from '../../src/types/globalInterfaces' | |
const request: FrontEndRequest = { | |
Emisor: { | |
Nombre: 'SRL', | |
Identificacion: { | |
Tipo: '02', | |
Numero: '3102759157' | |
}, | |
NombreComercial: 'CIENCIA DEL SABOR', | |
Ubicacion: { |
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
Element.prototype.parents = function(selector) { | |
var elements = []; | |
var elem = this; | |
var ishaveselector = selector !== undefined; | |
while ((elem = elem.parentElement) !== null) { | |
if (elem.nodeType !== Node.ELEMENT_NODE) { | |
continue; | |
} | |
NewerOlder