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
"use server"; | |
import { writeFile } from "fs/promises"; | |
import path from "path"; | |
export const uploadImage = async (data: FormData): Promise<string> => { | |
const image = data.get("image") as File | null; | |
if (!image) { | |
throw new Error("Image no found"); |
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 NextAuth from "next-auth"; | |
import CredentialProvider from "next-auth/providers/credentials"; | |
import prisma from "@/libs/prisma"; | |
import bcrypt from "bcrypt"; | |
interface Credentials { | |
email: string; | |
password: string; | |
} |
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
export default async function (key, endpoint, options = {}) { | |
const cache = ref(); | |
const { data: cachedData } = useNuxtData(key); | |
if (cachedData.value) { | |
cache.value = cachedData.value; | |
} else { | |
const { data, error } = await useLazyAsyncData( | |
key, | |
() => $fetch(endpoint), | |
options |
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
// Image guardada: localStorage.image; | |
// crear un evento onchange al tipo file del formulario o cuando hagas tu submit ejecutar lo siguiente | |
var file = fileInput.files[0]; | |
var reader = new FileReader(); | |
reader.onload = function(e) { | |
localStorage.imagen = reader.result; | |
} | |
reader.readAsDataURL(file); |
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
<?php | |
require_once 'simple_html_dom.php'; | |
$id = $_GET['id']; //_CustId_328224676 | |
if (isset($id)) { | |
$url = "https://listado.mercadolibre.cl/{$id}"; | |
$html = file_get_html($url); | |
$productos = array(); | |
foreach ($html->find("ol.ui-search-layout", 0)->find("li.ui-search-layout__item") as $key => $li) { | |
$items = array(); | |
$items['title'] = $li->find('h2.ui-search-item__title', 0)->plaintext; |
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
<?php | |
//@setcookie("user", "", time() - 3600); | |
//unset($_COOKIE); | |
//echo session_id(); | |
if (!session_id()) { | |
session_start(); | |
} | |
ini_set('display_errors', 0); | |
date_default_timezone_set('Asia/Kolkata'); |
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
<?php | |
function getRandomString($lng = 12) { | |
$charset = '0123456789'; | |
$randString = ""; | |
while(strlen($randString) < $lng) { | |
$randChar = substr(str_shuffle($charset), mt_rand(0, strlen($charset)), 1); | |
$randString .= $randChar; | |
} | |
return $randString; | |
} |
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 os, requests, json, xlsxwriter, base64 | |
import pandas as pd | |
from time import sleep | |
""" | |
@df: variable creada para lectura del archivo excel donde se encuentran todas las urls | |
@dfx: variable que contiene todos los valos leidos de df.values | |
@key: apikey generada de google | |
""" | |
df = pd.read_excel('urls.xlsx', sheet_name='Hoja1', index=False, header=None) |
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
add_filter('gettext', 'traductor'); | |
add_filter('ngettext', 'traductor'); | |
function traductor($text) { | |
$text = str_ireplace('Detalles de facturación', 'El texto que quiero aqui', $text); | |
return $text; | |
} |
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
<?php | |
require_once 'simple_html_dom.php'; | |
$id = $_GET['id']; //_CustId_328224676 | |
if (isset($id)) { | |
$url = "https://listado.mercadolibre.cl/{$id}"; | |
$html = file_get_html($url); | |
$productos = array(); | |
foreach ($html->find("ol.ui-search-layout", 0)->find("li.ui-search-layout__item") as $key => $li) { | |
$items = array(); | |
$items['title'] = $li->find('h2.ui-search-item__title', 0)->plaintext; |
NewerOlder