Skip to content

Instantly share code, notes, and snippets.

View mariano-aguero's full-sized avatar
:octocat:
Focusing

Mariano Aguero mariano-aguero

:octocat:
Focusing
View GitHub Profile
@Klerith
Klerith / recomendada.Dockerfile
Last active November 26, 2023 20:03
NextJS - Dockerfile - Configuración simple y recomendada
# Fuente: https://github.com/vercel/next.js/blob/canary/examples/with-docker/README.md
# Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
@spalladino
spalladino / falsehoods-that-ethereum-programmers-believe.md
Last active March 8, 2024 14:34
Falsehoods that Ethereum programmers believe

Falsehoods that Ethereum programmers believe

I recently stumbled upon Falsehoods programmers believe about time zones, which got a good laugh out of me. It reminded me of other great lists of falsehoods, such as about names or time, and made me look for an equivalent for Ethereum. Having found none, here is my humble contribution to this set.

About Gas

Calling estimateGas will return the gas required by my transaction

Calling estimateGas will return the gas that your transaction would require if it were mined now. The current state of the chain may be very different to the state in which your tx will get mined. So when your tx i

@ElRodrigote
ElRodrigote / Educación Financiera -101.md
Last active May 14, 2022 16:46
Este archivo contiene una recopilación de información que considero útil para gente que se está metiendo sin conocimiento previos en el mundo de educación financiera e inversiones.

Pasos iniciales que considero necesarios:

  1. Generá una masa crítica (mínimo necesario para que algo sea viable) de plata para invertir. Por definición, la inversión es poner un capital bajo un riesgo de pérdida para intentar obtener un retorno (ganancia), entonces tenés que estar dispuesto a perder esa plata que inviertas, porque puede pasar y es MUY REAL esa posibilidad. Idealmente NO debería pasar porque la idea de invertir es ganar guita, pero puede pasar. O sea no inviertas guita que NECESITES.

  2. Informate. Aprendé qué tipo de inversor sos (conservador, moderado o agresivo; en lineas generales), sé honesto con esto porque tu salud mental está en juego también si no te cuidás, no es joda. La ansiedad y el estrés te pueden coger de parado.

  3. Estudiá para lo que sea que quieras invertir. Si decidís volcarte al trading, estudiá trading. No seas paja. Yo me metí a los cabezazos como un cabrón y la pasé re mal. Estudiá como te sea comodo, pero estudiá. Invertir va de tomar decisiones informadas y e

@spalladino
spalladino / revert.ts
Created September 11, 2020 22:38
Get the revert reason before sending an Ethereum transaction if the transaction would fail
export async function tryGetRevertReason(to: string, from: string, data: string): Promise<string | undefined> {
const provider = ethers.getDefaultProvider();
const tx = { to, from, data };
try {
await provider.estimateGas(tx);
} catch {
const value = await provider.call(tx);
return hexDataLength(value) % 32 === 4 && hexDataSlice(value, 0, 4) === '0x08c379a0'
? defaultAbiCoder.decode(['string'], hexDataSlice(value, 4))
: undefined;
// This is universal, works with Infura -- set provider accordingly
const ethers = require('ethers')
//const provider = ethers.getDefaultProvider('rinkeby')
const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL)
function hex_to_ascii(str1) {
var hex = str1.toString();
var str = '';
for (var n = 0; n < hex.length; n += 2) {
@eolant
eolant / Confirm.vue
Last active March 23, 2024 08:48
Vuetify Confirm Dialog component that can be used locally or globally
<template>
<v-dialog v-model="dialog" :max-width="options.width" :style="{ zIndex: options.zIndex }" @keydown.esc="cancel">
<v-card>
<v-toolbar dark :color="options.color" dense flat>
<v-toolbar-title class="white--text">{{ title }}</v-toolbar-title>
</v-toolbar>
<v-card-text v-show="!!message" class="pa-4">{{ message }}</v-card-text>
<v-card-actions class="pt-0">
<v-spacer></v-spacer>
<v-btn color="primary darken-1" text @click.native="agree">Yes</v-btn>
@datchley
datchley / react-redux-style-guide.md
Last active February 13, 2024 14:30
React + Redux Style Guide
@GFoley83
GFoley83 / message-bus.service.ts
Last active June 2, 2020 12:55
Angular 2 Message Bus / PubSub ex.
import { Injectable } from "@angular/core";
import { ReplaySubject, Observable } from "rxjs/Rx";
interface Message {
channel: string;
data: any;
}
@Injectable()
export class MessageBus {
@nrollr
nrollr / nginx.conf
Last active May 11, 2024 16:31
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@izy521
izy521 / objectdeepcopy.js
Created July 30, 2016 17:28
`JSON.parse( JSON.stringify( obj) )` has been regarded as the fastest method for deep copying Objects, but is it? This is mainly just to test. Obviously Functions aren't allowed in JSON.
var Types = new Map();
Types.set(Array, function(v) {
var l = v.length; i = 0, a = Array(l);
for (i; i<l; i++) {
a[i] = v[i];
}
return a;
});
Types.set(Number, function(v) {
return v * 1;