Skip to content

Instantly share code, notes, and snippets.

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

Juan Ariel Brusco juanbrusco

🏠
Working from home
View GitHub Profile
@juanbrusco
juanbrusco / buttonWbuble.html
Created June 16, 2023 17:34
Button with icon and notification bubble
<button
style={{ paddingInline: 5, position: "relative" }}
title="button"
onClick={(e) => {
console.log(e);
}}
>
<span className="circleRed"></span>
<Icon icon="message"/>
</button>
@juanbrusco
juanbrusco / node-fetch-body.js
Created June 27, 2022 21:30
NodeJS fetch handling body
router.post('/endpointname', async function (req, res, next) {
let bodyObj = { "x": {} };
let requestURL = "https://reqres.in/api/register";
let requestOptions = {
method: "POST",
body: JSON.stringify(bodyObj),
headers: { 'Content-Type': 'application/json' }
};
try {
const urlResponse = await fetch(requestURL, requestOptions);
@juanbrusco
juanbrusco / node-fetch-err.js
Created June 27, 2022 15:04
NodeJS fetch handling error
router.post('/endpointname', async function (req, res, next) {
let bodyObj = { "x": {} };
let requestURL = "https://reqres.in/api/register";
let requestOptions = {
method: "POST",
body: JSON.stringify(bodyObj),
headers: { 'Content-Type': 'application/json' }
};
try {
const apiResponse = await fetch(requestURL, requestOptions);
@juanbrusco
juanbrusco / find_object.js
Created June 16, 2022 18:39
Find object within array
const pdcObject = pdcs_collection.find((pObj) => pObj.itemId == p.itemId);
@juanbrusco
juanbrusco / count_duplicates.js
Created June 16, 2022 18:37
Count duplicates within an Array of Objects
const arr = [
{
"Company": "IBM"
},
{
"Person": "ACORD LOMA"
},
{
"Company": "IBM"
},
@juanbrusco
juanbrusco / check_object.js
Last active June 16, 2022 18:38
How to Check If an Array Includes an Object in JavaScript
// An array of objects
var persons = [{name: "Harry"}, {name: "Alice"}, {name: "Peter"}];
// Find if the array contains an object by comparing the property value
if(persons.some(person => person.name === "Peter")){
alert("Object found inside the array.");
} else{
alert("Object not found.");
}
@juanbrusco
juanbrusco / PY0101EN-5-2-Numpy2D.ipynb
Created July 24, 2020 15:27
Created on Skills Network Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@juanbrusco
juanbrusco / PY0101EN-5-1-Numpy1D.ipynb
Created July 24, 2020 15:17
Created on Skills Network Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@juanbrusco
juanbrusco / PY0101EN-4.2_API_2.ipynb
Created July 24, 2020 14:51
Created on Skills Network Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@juanbrusco
juanbrusco / PY0101EN-4-2-WriteFile.ipynb
Created July 24, 2020 14:13
Created on Skills Network Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.