Skip to content

Instantly share code, notes, and snippets.

View juanigallo's full-sized avatar
🚀

Juani Gallo juanigallo

🚀
View GitHub Profile
const axios = require("axios");
const url =
"https://www.apple.com/shop/pickup-message-recommendations?mts.0=regular&mts.1=compact&cppart=UNLOCKED/US&searchNearby=true&store=R623&product=MQ933LL/A";
let lastMessageSend = 0;
const botId = "";
const chatId = "";
const jsonMap = {
import * as utils from "@dcl/ecs-scene-utils";
//Text
const nameEntity = new Entity();
const myName = new TextShape("@JuaniGallo");
nameEntity.addComponent(myName);
nameEntity.addComponent(new Transform({ position: new Vector3(8, 1, 8) }));
nameEntity.addComponent(
// Instanciamos una nueva entidad
const nameEntity = new Entity();
// Instanciamos un texto con el valor @JuaniGallo
const myName = new TextShape("@JuaniGallo");
// Asociamos nuestro nombre a la entidad que creamos al principio
nameEntity.addComponent(myName);
// Posicionamos nuestra entidad principal
import {
AddSubmission,
VouchAdded,
VouchRemoved
} from "../generated/ProofOfHumanity/ProofOfHumanity";
import { User } from "../generated/schema";
export function handleVouchAdded(event: VouchAdded): void {
let user = User.load(event.transaction.from.toHex());
[
{
id: 1,
name: "Prueba 1"
},
{
id: 2,
name: "Prueba 2"
}
]
@juanigallo
juanigallo / palindrome.js
Created September 8, 2017 19:56
Check if a string is a palindrome. JavaScript implementation
//v1 without built in functions
function palindrome(str) {
var len = str.length,
mid = Math.floor(len/2);
for ( var i = 0; i < mid; i++ ) {
if (str[i] !== str[len - 1 - i]) {
return false;
}
}
@juanigallo
juanigallo / reverse.js
Created September 8, 2017 19:55
Reverse a string with JavaScript
//Using built-in functions
function reverseString(str) {
return str.split("").reverse().join("");
}
//Without built-in functions
function reverseString(str) {
var newString = "";
for (var i = str.length - 1; i >= 0; i--) {
newString += str[i];
@juanigallo
juanigallo / prime.js
Created September 8, 2017 19:53
Find if a number is prime or not. Javascript implementation
function isPrime(value) {
for(var i = 2; i < value; i++) {
if(value % i === 0) {
return false;
}
}
return value > 1;
}
@juanigallo
juanigallo / findDuplicates.js
Created September 8, 2017 18:11
Find duplicates in array.
function findDuplicates(arr) {
for (var i = 0; i < arr.length; i++){
if (arr[Math.abs(arr[i])] >= 0) {
arr[Math.abs(arr[i])] = -arr[Math.abs(arr[i])]
} else {
console.log(Math.abs(arr[i] + " "));
}
}
}
@juanigallo
juanigallo / checkSum.js
Created September 8, 2017 18:10
Check sum of unordered array in JavaScript
function checkUnorderedSum(arr, sum) {
let alreadySeen = [];
for (var i = 0; i < arr.length; i++) {
let complement = sum - arr[i];
if (alreadySeen.indexOf(arr[i]) > -1) {
return true
}