Skip to content

Instantly share code, notes, and snippets.

View rodineiti's full-sized avatar

Rodinei Teixeira rodineiti

View GitHub Profile
function delta(a, b, c) {
return (b * b) - ((4 * a) * c);
}
function baskara(a, b, c) {
var delt = delta(parseFloat(a), parseFloat(b), parseFloat(c));
var x1 = (-b + Math.sqrt(delt)) / (2 * a);
var x2 = (-b - Math.sqrt(delt)) / (2 * a);
@rodineiti
rodineiti / gist:06e62e21575c8f53f889b9cec95753eb
Created January 26, 2021 17:54
Conversor números romanos em inteiro com Javascript
console.clear();
console.log(convert("VIxiv"));
function convert(value) {
let total = 0;
let length = value.length;
for (let i = 0; i < length; i++) {
if (i < length - 1 && romans(value[i+1]) > romans(value[i])) {
total -= romans(value[i]);
} else {
let timer = setInterval(function() {
let item = $(".paredao_padding")[2];
$(item).find("a").click();
let text = $("#voto_ocultar").find("img")[0].src;
let index = text.indexOf("=");
let realtext = text.substr(index + 1, 8);
$("input[name=code]").val(realtext.substr(2, 1) + realtext.substr(4, 1) + realtext.substr(7, 1));
$("input[type=submit]").click();
}, 5000);
let count = 0;
let arr = document.querySelectorAll(".y3zKF");
let timer;
arr.forEach((value, index) => {
timer = setTimeout(() => {
if(!value.classList.contains("_8A5w5")) {
value.click();
console.log("Seguiu " + count + " pessoas.");
count++;
if (count >= 30) {
## criar container postgres setando variáveis de ambiente
docker run \
--name postgres-name \
-e POSTGRES_USER=root \
-e POSTGRES_PASSWORD=root \
-e POSTGRES_DATABASE=demo \
-p 5432:5432 \
-d \
postgres
<style>
#sound {
display:block;
}
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
@rodineiti
rodineiti / server.js
Created June 8, 2020 18:59
Crud projects in array with node and express - routes and middlewares
const express = require("express");
const server = express();
server.use(express.json());
const projects = [{ id: "1", title: "Projeto 1", tasks: [] }];
// middleware global
server.use((request, response, next) => {
@rodineiti
rodineiti / server.js
Created June 8, 2020 17:48
Crud users in array with node and express - routes and middlewares
const express = require("express");
const server = express();
server.use(express.json());
const users = ["Rodinei", "Fulano", "Ciclano"];
// middleware global
server.use((request, response, next) => {
'use strict'
const fibonacci = () => {
let arr = [];
for (let index = 0; index < 350; index++) {
if (index < 2) {
arr.push(index);
} else {
const value = arr[index - 1] + arr[index - 2];
arr.push(value);
# RUN TO INSTALL MYSQL: python -m pip install mysql-connector
import mysql.connector
db_connection = mysql.connector.connect(
host="host",
user="user",
passwd="password",
database="database"
)