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 / transform-text-link.js
Created November 7, 2018 19:57
Transform Text To Link - React + Js
@juanbrusco
juanbrusco / heart-animation-icon.scss
Created September 5, 2018 20:56
Heart animation - SCSS
//animation like - twitter opt1
.heart {
width: 50px;
height: 50px;
background: url("https://cssanimation.rocks/images/posts/steps/heart.png") no-repeat;
background-size: cover;
background-position: 0 -7px;
cursor: pointer;
transition: background-position 1s steps(28);
transition-duration: 0s;
@juanbrusco
juanbrusco / detect-duplicate.ftl
Created September 5, 2018 20:54
Detect duplicates into list - Freemarker
<#assign newList = [] />
<#list response.data.items as originalList>
<#if ! newList?seq_contains(originalList.xValue)>
<#assign newList = newList + [originalList.xValue] />
</#if>
</#list>
@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 / 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 / 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 / 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.