$ node -v$ sudo npm install -g n(Use this command to install the stable node release.)| # arquivo soma.py | |
| class Soma(): | |
| def __init__(self, name: str) -> None: | |
| self.name = name | |
| def sum(self, a, b) -> int: | |
| return a + b | |
| def str_name(self) -> str: | |
| return self.name |
| 'use strict'; | |
| const lodash = require('lodash'); | |
| const {v4} = require('uuid'); | |
| const express = require('express'); | |
| const app = express(); | |
| app.use(express.json()); |
| const { Worker } = require('bullmq') | |
| const redisConfiguration = { | |
| connection: { | |
| host: "localhost", | |
| port: 6379, | |
| username: "default", | |
| password: "redispw" | |
| } | |
| } |
| async function fetchData() { | |
| try { | |
| const response = await fetch('https://api.spacexdata.com/v4/launches/latest'); | |
| if (!response.ok) { | |
| throw new Error('Network response was not ok'); | |
| } | |
| const data = await response.json(); | |
| console.log('Data:', data); | |
| } catch (error) { |
| import { test, mock } from 'node:test'; | |
| import assert from 'node:assert'; | |
| import fs from 'node:fs'; | |
| test('first test', (t) => { | |
| assert.strictEqual(8, 8); | |
| }); | |
| test('second test', (t) => { | |
| assert.strictEqual(9, 9); |
$ node -v$ sudo npm install -g n(Use this command to install the stable node release.)| // Decorator de split | |
| function splitDecorator(target: any, propertyKey: string, descriptor: PropertyDescriptor) { | |
| const originalMethod = descriptor.value; | |
| descriptor.value = function (str: string) { | |
| const arr = str.split(''); | |
| return originalMethod.apply(this, [arr]); | |
| }; | |
| return descriptor; |
| console.log('lua é top das galáxias'); |
| const express = require('express'); | |
| const app = express() | |
| const os = require ('os') | |
| const cluster = require ('cluster') | |
| const numCPU = os.cpus().length | |
| app.get('/heavy', (req, res)=> { | |
| counter = 0; | |
| for (let index = 0; index < 10000000000000; index++) { |
| import React from 'react' | |
| import { toast, ToastContainer } from "react-toastify"; | |
| import "react-toastify/dist/ReactToastify.css"; | |
| export function App() { | |
| function handleClick() { | |
| toast.error('error'); | |
| } |