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
import { useEffect, useState } from "react"; | |
import { getAuth } from "@firebase/auth"; | |
import Router from "next/router"; | |
const auth = getAuth() | |
export const AuthGuard = ({ children, redirectUrl }: any) => { | |
const [isLoading, setIsLoading] = useState(true); | |
const [isAuthenticated, setIsAuthenticated] = useState(false); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Child Window</title> | |
<script type="text/javascript"> | |
//esta funcion escucha eventos desde parent.html para recibir los datos del archivo | |
window.addEventListener('message', function(e) { | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Parent Window</title> | |
</head> | |
<body> | |
<div> | |
<input onchange="readFileContent(this)" type="file" id="input-file"> | |
</div> |
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
buildFormula <- function(dataset, LTerms, useTrend=FALSE, useSeason=FALSE) { | |
lLen <- length(LTerms) | |
for (i in 1:lLen) | |
assign(paste("fact", i, sep=""), L(dataset, LTerms[i])) | |
factors = array() | |
for (i in 1:lLen) | |
factors[i] <- paste("fact", i , sep="") |
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
buildFormula <- function(dataset, terms_array) { | |
for (i in 1:length(terms_array)) | |
assign(paste("fact", i, sep=""), L(dataset, terms_array[i])) | |
factors = array() | |
for (i in 1:length(terms_array)) | |
factors[i] <- paste("fact", i, sep="") | |
form = as.formula(paste("dataset~", paste(factors, collapse="+"))) | |
return(form) |
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
import random | |
import time | |
class Card(object): | |
def __init__(self, number, kind): | |
self.number = number | |
self.kind = kind |
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
library(quantreg) | |
airq <- airquality | |
#fit the quantile regression with Ozone formula | |
fit <- rq(Ozone ~ ., data=airquality) | |
#create a new dataframe with the values to forecast the Ozone | |
newdata <- data.frame(Solar.R=201:203, Wind=8:10, Temp=82:84, Month=9, Day=20:22) | |
#newdata is the parameter to tell the predict function to use the values for making the forecast | |
fore <- predict(fit, newdata=newdata) |
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
import itertools | |
def get_all_sum_combinations(elements): | |
""" | |
Gets all the combinations of the sum of a list of elements. | |
""" | |
combinations = [] | |
for i in range(1, len(elements) + 1): | |
for subset in itertools.combinations(elements, r=i): | |
result = sum(subset) |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Carrusel Ejemplo</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- Archivos de bootstrap --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> |
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
from django.db import connection | |
from functools import wraps | |
def check_db_connection(f): | |
@wraps(f) | |
def inner(*args, **kargs): | |
try: | |
connection.connection.ping() | |
except: | |
connection.close() | |
return f(*args, **kargs) |
NewerOlder