function getDateLastDayOfMonth(date) {
if (!date) return;
const [year, month] = date.split('-');
const lastDay = new Date(year, month, 0).getDate();
// JavaScript months are 0-indexed
return new Date(Date.UTC(year, month - 1, lastDay, 12));
}
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
asd |
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 pressRightArrow() { | |
// Identifica o elemento que deve receber o evento de tecla | |
const element = document.activeElement || document.body; | |
// Cria o evento de pressionamento da tecla (keydown) | |
const keydownEvent = new KeyboardEvent('keydown', { | |
key: 'ArrowRight', | |
code: 'ArrowRight', | |
keyCode: 39, | |
which: 39, |
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 axios from "axios" | |
import { ModalTop } from "~/components/modal-top" | |
import { notify } from "~/components/snackbar" | |
import { useAddProductContext } from "./helpers/use-add-product-context" | |
import CurrencyInput from "~/components/money-field" | |
import Label from "./label" | |
import { Input } from "~/components/input" | |
import { useStockContext } from "../../stock/helpers/use-stock-context" | |
import { defaultProductData } from "./helpers/use-add-product-context" | |
import CategorySelection from "./category-selection" |
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
#!/bin/bash | |
# Install PHP 5.6 and other dependencies | |
sudo apt-get update | |
sudo apt-get install -y software-properties-common ca-certificates lsb-release apt-transport-https | |
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php | |
sudo apt-get update && sudo apt-get install -y php5.6-zip apache2 php5.6 php5.6-mysql php5.6-ldap curl php5.6-mcrypt mariadb-server | |
# Install Composer | |
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer |
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 { PutObjectCommand, S3Client } from "@aws-sdk/client-s3"; | |
import { readFileSync } from "fs"; | |
import { uuid } from "uuidv4"; | |
const STORAGE_BUCKET = 'voluntario' | |
const client = new S3Client({ | |
region: "us-east-2", | |
credentials: { | |
accessKeyId: "", |
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 { prisma } from "@/db.server"; | |
import { getUser } from "@/session.server"; | |
import type { PutObjectCommandInput } from "@aws-sdk/client-s3"; | |
import { S3Client } from "@aws-sdk/client-s3"; | |
import { PutObjectCommand } from "@aws-sdk/client-s3"; | |
import { delCachedData, presetValues } from "./utils/utils"; | |
import { v4 as uuid } from "uuid"; | |
const { STORAGE_ACCESS_KEY, STORAGE_SECRET, STORAGE_REGION, STORAGE_BUCKET } = | |
process.env; |
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
# Drop local db with force | |
docker exec -it $(docker ps | grep postgres | awk '{print $1}') psql -U postgres -d postgres -c "DROP DATABASE pedegas WITH (FORCE);" | |
# Create DB | |
docker exec -it $(docker ps | grep postgres | awk '{print $1}') psql -U postgres -d postgres -c "CREATE DATABASE pedegas;" | |
# Restore DB | |
bash -c 'gunzip -c ~/Documents/*.tar.gz | pg_restore --dbname="postgresql://postgres:postgres@localhost:5432/pedegas"' | |
# Clean Redis data | |
docker exec -it $(docker ps | grep redis | awk '{print $1}') redis-cli -a ads FLUSHALL |
docker run -e MYSQL_ROOT_PASSWORD=password -d -p 3306:3306 mysql
NewerOlder