This file contains hidden or 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
| class ListLigada{ | |
| obj = { | |
| anterior: null, | |
| proximo: null, | |
| valor: null | |
| } | |
| calda = null | |
| cabeca = null | |
This file contains hidden or 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
| module.exports = (params) => { | |
| const app = { | |
| print: async () => { | |
| console.log(params) | |
| } | |
| } | |
| return app | |
| } |
This file contains hidden or 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
| class ListLigada{ | |
| obj = { | |
| anterior: null, | |
| proximo: null, | |
| valor: null | |
| } | |
| calda = null | |
| cabeca = null | |
This file contains hidden or 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
| class Helper { | |
| static getHelloWorldSync = () => { | |
| return "Hello World Sync" | |
| } | |
| static getHelloWorldAsync = async () => { | |
| return "Hello World Async" | |
| } | |
| } | |
This file contains hidden or 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 test = async () => { | |
| const url = new URL('https://example.com?foo=1&bar=2'); | |
| const params = new URLSearchParams(url.search); | |
| console.log(params.get('foo')) | |
| console.log(params.get('bar')) | |
| const entries = params.entries() | |
| for (const item of entries) { |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main(){ | |
| int size=5,*array; | |
| array=(int*)malloc(size * sizeof(int)); | |
| for(int i=0;i<size;i++){ | |
| array[i] = i; | |
| } | |
| for(int i=0;i<size;i++){ | |
| printf("dobro de %d é %d\n",i,array[i]*2); |
This file contains hidden or 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
| /* | |
| Esse InputSearch faz o search / request / qq coisa depois de 500ms que parou de digitar a última letra. | |
| Isso evita gerar requests desnecessários e entupir o backend com requests. Essa técnica de delay evita | |
| fazer múltiplos requests e faz o request apenas quando parar de digitar. | |
| Use: | |
| <InputSearch open={true} close={()=>setSearching(false)} /> | |
| */ | |
| import React, { useState, useEffect } from 'react'; |
This file contains hidden or 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 toSeoUrl = (name) => { | |
| return name.toString() // Convert to string | |
| .normalize('NFD') // Change diacritics | |
| .replace(/[\u0300-\u036f]/g,'') // Remove illegal characters | |
| .replace(/\s+/g,'-') // Change whitespace to dashes | |
| .toLowerCase() // Change to lowercase | |
| .replace(/&/g,'-and-') // Replace ampersand | |
| // eslint-disable-next-line | |
| .replace(/[^a-z0-9\-]/g,'') // Remove anything that is not a letter, number or dash |
This file contains hidden or 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 shuffle = (array) => array.map((a) => ({sort: Math.random(), value: a})) | |
| .sort((a, b) => a.sort - b.sort) | |
| .map((a) => a.value) | |
| console.log(shuffle([1,2,3,4,5])) |
This file contains hidden or 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 fetch = require('node-fetch') | |
| const { TwitterApi } = require( 'twitter-api-v2') | |
| const getTabNews = async () => { | |
| const response = await fetch(`https://www.tabnews.com.br/api/v1/contents?page=1&per_page=50&strategy=relevant`) | |
| return await response.json() | |
| } | |
| const tweet = async (text,links) => { | |
| console.log('tweet tab news ranking started') |