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 fs = require("fs"); | |
const { faker } = require('@faker-js/faker'); | |
for (let i = 1; i < 5001; i++) { | |
id = i; | |
prenome = `${faker.person.firstName()}`.replace("'","").replace("-"); | |
sobrenome = `${faker.person.lastName()}`; | |
usuario = `${prenome.slice(0,1)}${sobrenome}`.toLowerCase(); | |
email = `${prenome.toLowerCase()}.${sobrenome.toLowerCase()}@gmail.com`; | |
saldo = faker.finance.amount(); |
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 avgSort (arr) { | |
let arrc = [arr] | |
while (true) { | |
let arrn = [] | |
for (i in arrc) { | |
if (arrc[i].length === 1) { | |
arrn.push(arrc[i]) | |
continue | |
} | |
let avg = arrc[i].reduce((a, b) => a + b, 0) / arrc[i].length |
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
arrObservers = [] | |
const Observable = { | |
register: function(func) { | |
arrObservers.push(func) | |
}, | |
eventEmitter: function() { | |
let msg = 'Mensagem do observable' | |
arrObservers.forEach(o => { |
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
def flatten_array(arr) | |
res = [] | |
while true do | |
arr.each{ |i| (i.class.to_s == "Integer") ? res.push(i) : res.concat(i) } | |
cont = res.reject{ |i| i.class.to_s == "Integer"}.length.to_i | |
break if cont === 0 | |
arr = res | |
res = [] | |
end | |
res |
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
// Assume image.alfa.jpg is in the same directory the components are | |
// Component01.js | |
import React from 'react'; | |
import Component02 from './Component02.js'; | |
export default class Component01 extendes React.Component { | |
render() { | |
return( |
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
"static-server": "node ./src/statics.js", | |
"start-all": "npm run static-server & npm start" |
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
var express = require('express'); | |
var app = express(); | |
app.use(express.static('your/path/to/images')); | |
app.listen(3001, function () { | |
console.log('Example app listening on port 3000!'); | |
}); |
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
<img src={require(image_path)} alt="React example" /> // <== This won't work either |
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
// Assume image.alfa.jpg is in the same directory the components are | |
// Component01.js | |
import React from 'react'; | |
import Component02 from './Component02.js'; | |
export default class Component01 extendes React.Component { | |
render() { | |
return( |
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 React from 'react'; | |
import image from './image.jpg'; | |
export default class MyExampleComponent extends React.Component { | |
render() { | |
return( | |
<img src={image} alt="React example" /> // <== This will work | |
) | |
} |
NewerOlder