Skip to content

Instantly share code, notes, and snippets.

View riccardogiorato's full-sized avatar
🏠
Working from home

Riccardo Giorato riccardogiorato

🏠
Working from home
View GitHub Profile
const baseUrlTesla = "https://www.tesla.com/";
const urlHttpsWww = "https://www.tesla.com/";
it(urlHttpsWww + " end location", () => {
cy.visit(urlHttpsWww);
cy.url().should("eq", baseUrlTesla);
});
it("200 homepage response", () => {
cy.request({
url: urlHttpsWww,
followRedirect: false,
const baseUrlTesla = "https://www.tesla.com/";
const urlHttp = "http://tesla.com";
it(urlHttp + " end location", () => {
cy.visit(urlHttp);
cy.url().should("eq", baseUrlTesla);
});
it(urlHttp + " redirect", () => {
cy.request({
url: urlHttp,
followRedirect: false, // turn off following redirects
console.log("Let's run also this Node.js script!");
console.log("You can run any kind of Node.js code inside here!");
const queryGetAllUsers = "query allUsers";
const listOfUsers = graphqlRequest.query("queryGetAllUsers"); // <- call hasura endpoint
const otherFunctionLocal = require("./otherFunction");
aws s3 cp DIRECTORY_OR_FILE s3://BUCKET_NAME --recursive --quiet
import * as s3Deployment from "@aws-cdk/aws-s3-deployment";
const websiteBucket = new s3.Bucket(this, 'WebsiteBucket', {
websiteIndexDocument: 'index.html',
publicReadAccess: true
});
new s3deploy.BucketDeployment(this, 'DeployWebsite', {
sources: [s3deploy.Source.asset('./website-dist')],
destinationBucket: websiteBucket,
@riccardogiorato
riccardogiorato / cdk-s3-deployment.js
Last active June 8, 2021 06:26
CDK s3 deployment example
import * as s3Deployment from "@aws-cdk/aws-s3-deployment";
const websiteBucket = new s3.Bucket(this, 'WebsiteBucket', {
websiteIndexDocument: 'index.html',
publicReadAccess: true
});
new s3deploy.BucketDeployment(this, 'DeployWebsite', {
sources: [s3deploy.Source.asset('./website-dist')],
destinationBucket: websiteBucket,
@riccardogiorato
riccardogiorato / btt.sh
Last active June 1, 2021 06:17
BTT file to run Monero miner on a Mac
./xmrig -o rx.unmineable.com:3333 -a rx -k -u BTT:TSxPegAweaAMrvZGJEd3LRJMtZm7XC14oc.mac#0o5w-vby4 -p x
pause
@riccardogiorato
riccardogiorato / hello.js
Created April 19, 2021 18:59
hello world for vercel api lambda functions
module.exports = (req, res) => {
const { name = 'World' } = req.query
res.status(200).send(`Hello ${name}!`)
}
// import Sheets from 'node-sheets';
const Sheets = require("node-sheets").default;
const dotenv = require("dotenv");
dotenv.config();
/*
Google Sheet example with a list of students here
https://docs.google.com/spreadsheets/d/1-UeQshwrIbxUwYuTIspGlSdUsy6cR1gDR6texuyB7G4/edit?usp=sharing
*/
import { gql, useMutation } from "@apollo/client";
/* more code */
const ADD_WISHLIST = gql`
mutation ADD_WISHLIST(
$email: String!
$plant: String!
$suggestion: String!
) {