Skip to content

Instantly share code, notes, and snippets.

View guilouro's full-sized avatar
💻
coding

Guilherme Louro guilouro

💻
coding
View GitHub Profile
const puppeteer = require('puppeteer');
const fs = require("fs");
const HEADLESS = true
const getGameData = async (url) => {
const browser = await puppeteer.launch({ headless: HEADLESS });
const page = await browser.newPage();
await page.goto(url, { waitUntil:"networkidle2" });
@guilouro
guilouro / python-simple-pagination.py
Last active October 12, 2018 15:03
A simple pagination that return an array when passed current and total item.
def pagination(current, last):
delta = 2
left = current - delta
right = current + delta + 1
myrange = []
rangeWithDots = []
l = 0
for i in range(1, last+1):
if (i == 1 or i == last or i >= left and i < right):
@guilouro
guilouro / bitbucket-pipelines.yml
Created May 15, 2017 16:55
publish npm with bitbucket pipeline
image: node:7
pipelines:
default:
- step:
script:
- printf "//`node -p \"require('url').parse(process.env.NPM_REGISTRY_URL || 'https://registry.npmjs.org').host\"`/:_authToken=${NPM_TOKEN}\nregistry=${NPM_REGISTRY_URL:-https://registry.npmjs.org}\n" >> ~/.npmrc
- npm publish
@guilouro
guilouro / clone_bitbucket_docker.txt
Last active November 9, 2021 16:22
Clone bitbucket private repo in Dockerfile
FROM ubuntu
MAINTAINER Guilherme Louro "guipclouro@gmail.com"
# Update aptitude with new repo
RUN apt-get update
# Install software
RUN apt-get install -y git
# Make ssh dir
@guilouro
guilouro / template_amp.html
Created December 12, 2016 13:42 — forked from adrianoalmeida7/template_amp.html
HTML Básico para AMP
<!doctype html>
<html amp lang="pt-BR">
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<link rel="canonical" href="http://caminho_do_arquivo_original/arquivo.html">
<title>Página compatvel com AMP</title>
<link rel="canonical" href="http://example.ampproject.org/article-metadata.html" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{