Skip to content

Instantly share code, notes, and snippets.

View lmcarreiro's full-sized avatar

Leonardo Carreiro lmcarreiro

View GitHub Profile
@lmcarreiro
lmcarreiro / questions.jsx
Last active April 7, 2021 06:52
React questions
/* eslint-disable */
import React from "react";
export function Component1(props) {
const [user, setUser] = useState();
useEffect(() => {
fetch(`/user/${props.id}`).then(user => {
setUser(user);
});
@lmcarreiro
lmcarreiro / questions.js
Last active April 7, 2021 06:15
Javascript questions
/* eslint-disable */
function q1() {
const person = { age: 20, name: "Ben" };
const peopleArray = [person, person, person];
peopleArray[1].name = "Joe";
console.log(peopleArray[0].name, peopleArray[1].name, peopleArray[2].name);
}
function q2() {
@lmcarreiro
lmcarreiro / intro.js
Created November 1, 2019 12:41
Teste intro.js crachá
const style = document.createElement("link")
style.href = "https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.9.3/introjs.css";
style.type = "text/css";
style.rel = "stylesheet";
document.head.appendChild(style);
document.body.style.paddingTop = "1px";
document.body.style.marginTop = "-1px";
const nome = document.querySelector('div.profile h3').firstChild.textContent.split(' ')[0];
@lmcarreiro
lmcarreiro / index.js
Last active June 5, 2019 12:46
Webpack error with multiple configurations and --info-verbosity verbose
console.log("client");
@lmcarreiro
lmcarreiro / webpack.config.js
Created June 3, 2019 17:59
Webpack error with multiple configurations
// @ts-check
const webpack = require('webpack');
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = [clientConfig, serverConfig]; // Array of functions that returns the object fails
//module.exports = env => [clientConfig(env), serverConfig(env)]; // Function that return an array of objects fails
//module.exports = [clientConfig(), serverConfig()]; // Array of objects fails
@lmcarreiro
lmcarreiro / excel-workbook.yaml
Created March 6, 2019 18:33
Proposal of a excel workbook using a readable YAML text file structure
%YAML 1.2
%TAG !excel! tag:microsoft.com,2019:excel/
%TAG !w3c! tag:w3.org,2000:
--- !excel!workbook
Metadata:
Authors: Leonardo Machado Carreiro
Last saved by: Leonardo Machado Carreiro
Program name: Microsoft Excel
@lmcarreiro
lmcarreiro / Program.cs
Created February 21, 2019 16:41
Get list of Access Point (BSSID and Signal) using C#
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@lmcarreiro
lmcarreiro / test-args.sh
Created February 11, 2019 15:19
Bash script to get named arguments
#!/bin/bash
# File: test-args.sh
#
# Test with:
# ./test-args.sh --a1 a1 --a2 "a 2" --a3 --a4= --a5=a5 --a6="a 6"
#
# Output:
# a1 = "a1"
# a2 = "a 2"
@lmcarreiro
lmcarreiro / package.json
Created January 25, 2019 16:00
bug on yarn install inside docker container (node:10.15.0 image) without proxy
{
"name": "mope-web-client",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
@lmcarreiro
lmcarreiro / curl
Last active August 22, 2018 18:02
curl 'http://ecoporanga2.uo-es.petrobras.com.br:31091/api/Geo/SalvarCoordenadas' -H 'Origin: http://ecoporanga2.uo-es.petrobras.com.br:31091' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: */*' -H 'Referer: http://ecoporanga2.uo-es.petrobras.com.br:31091/prototipo2' -H 'Cookie: _ga=GA1.3.1116397345.1524857640; STDefaultServiceProvider=com.polycom.dma.tcspi.DmaConferenceService; lconn.profiles.sametime.currentStatus=1; _gid=GA1.3.199963334.1534949731' -H 'Connection: keep-alive' --data-binary '{"Video":"","Ducarao":0,"Imagem":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUsAAAAvCAYAAABqpehmAAAF3UlEQVR4Xu2c67LcIAyDd9//oU8nbTOTZgKSQGazjfqzx/jy2QhIL+/X6/Xzyq8QCIEQCIEugXfEMhMSAiEQAphAxBIzikUIhEAIvCKWGYIQCIEQIAhELAlIMQmBEAiBiGVmIARCIAQIAhFLAlJMQiAEQiBimRkIgRAIAYJAxJKAFJMQCIEQiFhmBkIgBEKAIB