Skip to content

Instantly share code, notes, and snippets.

View Alezco's full-sized avatar
🚀
Angular 3 expert, PHP 6 enthusiast

Benjamin Morali Alezco

🚀
Angular 3 expert, PHP 6 enthusiast
View GitHub Profile
@Alezco
Alezco / index.js
Last active August 31, 2022 20:29
Puppeteer in Google Cloud Functions
const puppeteer = require('puppeteer');
const PUPPETEER_OPTIONS = {
headless: true,
args: [
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--timeout=30000',
'--no-first-run',
@Alezco
Alezco / package.json
Last active February 16, 2019 13:04
package.json for Puppeteer in Google Cloud Functions
{
"name": "scrapingProject",
"version": "1.0.0",
"dependencies": {
"puppeteer": "^1.8.0"
},
"scripts": {
"deploy": "gcloud functions deploy scrapingExample --trigger-http --runtime nodejs8 --memory 1024MB --region europe-west1",
"start": "functions start && functions deploy --source=. scrapingExample --trigger-http"
}
@Alezco
Alezco / index.js
Last active February 16, 2019 14:22
Google Cloud Storage in Google Cloud Functions
const puppeteer = require('puppeteer');
const { Storage } = require('@google-cloud/storage');
const storage = new Storage({
projectId: 'your-gcp-project-id',
keyFilename: 'keyfile.json',
});
const BUCKET_NAME = 'your-gcp-bucket-name';
const BucketInstance = storage.bucket(BUCKET_NAME);
@Alezco
Alezco / user-list-class.js
Last active April 22, 2020 08:44
User list using a ReactJS class component
import React from "react";
class UserList extends React.Component {
constructor(props) {
super(props);
this.state = {
isVisible: true,
users: [],
};
this.toggleVisibility = this.toggleVisibility.bind(this);
@Alezco
Alezco / user-list-functional.tsx
Last active August 5, 2020 04:24
User list using a React Typescript functional component
import React, { FC, useCallback, useEffect, useMemo, useState } from "react";
type UserListProps = {
title: string;
};
type User = {
firstName: string;
lastName: string;
};