Skip to content

Instantly share code, notes, and snippets.

View andreguerrerosilvera's full-sized avatar

andreguerrerosilvera

View GitHub Profile
Game Type Main Focus Player Role Example
Incremental Exponential growth through clicks or upgrades Active player Cookie Clicker
Idle Passive progress through automation Observer + optimizer Idle Miner Tycoon
Tycoon Business growth and strategic management Decision-maker RollerCoaster Tycoon
@andreguerrerosilvera
andreguerrerosilvera / README.md
Created September 4, 2024 06:41 — forked from nivethan-me/README.md
Add Cloudflare Custom Domain to Vercel

Add Cloudflare custom domain to Vercel

  1. Sign up and sign in to Cloudflare https://dash.cloudflare.com/sign-up.
  2. In your Cloudflare dashboard, select the Domain Registration > Register Domains tab.
  3. Search for your favorite domain and purchase it. In my case, I purchased the domain https://nivethan.me/ for my portfolio.
  4. Sign in to Vercel and go to your dashboard, where you can see all your projects in the Overview tab.
  5. Click on a project and on the top right, select Domains.
  6. Type your domain in the text box, e.g., nivethan.me, and click Add.
  7. Select the recommended option: Add www.nivethan.me and redirect nivethan.me to it.
  8. Vercel will show an invalid configuration under your domains and display the relevant A record IP under nivethan.me and a CNAME IP under www.nivethan.me. These need to be set up on Cloudflare to make it work.
.data
prompt1: .asciiz "Ingrese el primer número: "
prompt2: .asciiz "Ingrese el segundo número: "
prompt3: .asciiz "Ingrese el tercer número: "
result: .asciiz "El número mayor es: "
.text
main:
# Solicitar al usuario que ingrese el primer número
li $v0, 4 # Cargar el servicio de impresión de cadena
.data
prompt1: .asciiz "Ingrese el primer número: "
prompt2: .asciiz "Ingrese el segundo número: "
prompt3: .asciiz "Ingrese el tercer número: "
result: .asciiz "El número menor es: "
.text
main:
# Solicitar al usuario que ingrese el primer número
li $v0, 4 # Cargar el servicio de impresión de cadena
.data
prompt: .asciiz "Ingrese un número para generar la serie de Fibonacci: "
result: .asciiz "La serie de Fibonacci es: "
.text
main:
# Solicitar al usuario que ingrese un número
li $v0, 4 # Cargar el servicio de impresión de cadena
la $a0, prompt # Cargar la dirección del mensaje
syscall # Llamar al servicio de impresión
@andreguerrerosilvera
andreguerrerosilvera / InputAutocomplete.tsx
Last active April 16, 2024 10:18
Creating a custom reusable Combobox using headless-ui for react
import { Combobox } from '@headlessui/react';
interface InputAutocompleteProps<T> {
multiple?: boolean;
labelExtractor: (item: T) => string;
handleChange: (query: string) => void;
}
export function InputAutocomplete<T>({
multiple,
@andreguerrerosilvera
andreguerrerosilvera / minValueToBalance.js
Last active January 19, 2022 21:11
Balance array: Given an array of even size N, task is to find minimum value that can be added to an element so that array become balanced. An array is balanced if the sum of the left half of the array elements is equal to the sum of right half.
function sum(arr) {
return arr.reduce((accumulator, num) => (accumulator + num), 0)
}
function minValueToBalance(arr) {
const middleIndex = Math.ceil(arr.length / 2);
const leftHalf = arr.slice(0, middleIndex);
const rightdHalf = arr.slice(middleIndex, arr.length);
return Math.abs(sum(leftHalf) - sum(rightdHalf));
}
@andreguerrerosilvera
andreguerrerosilvera / crypt.js
Created January 29, 2020 22:31
Generate a hash to password when user create an account
const generatePasswordHash = async (password) => {
try {
const salt = await bcrypt.genSalt(saltRounds);
const passwordHashed = await bcrypt.hash(password, salt);
return passwordHashed;
} catch (err) {
throw new Error(`The salt or the hash couldn't be generated`)
}
};
@andreguerrerosilvera
andreguerrerosilvera / POST.md
Created March 25, 2019 05:04 — forked from rikukissa/POST.md
React Hook prompting the user to "Add to homescreen" 🏠 #PWA #React

React Hook for showing custom "Add to homescreen" prompt

Demo:
Twitter

Simple React Hook for showing the user a custom "Add to homescreen" prompt.

const [prompt, promptToInstall] = useAddToHomescreenPrompt();