Skip to content

Instantly share code, notes, and snippets.

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

Alfonso alfonsodev

🏠
Working from home
View GitHub Profile
@alfonsodev
alfonsodev / irpf.js
Created January 22, 2023 21:19
calculo IRPF comunidad valenciana pasar la base imponible como argumento en la linea de comandos
const baseImponible = process.argv[2];
const tramosBaseEstado = [
{ hasta: 0, porcentaje: 0 },
{ hasta: 12450, porcentaje: 9.5 },
{ hasta: 20200, porcentaje: 12 },
{ hasta: 35200, porcentaje: 15 },
{ hasta: 60000, porcentaje: 18.5 },
{ hasta: 300000, porcentaje: 18.5 },
{ hasta: 0000000000, porcentaje: 22.5 },
];
@alfonsodev
alfonsodev / package.json
Created September 18, 2020 12:52
package madness
{
"name": "xxxxx",
"version": "0.1.0",
"private": true,
"main": "public/electron.js",
"homepage": "./",
"dependencies": {
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@testing-library/jest-dom": "^5.11.0",
@alfonsodev
alfonsodev / configureStore.ts
Last active September 6, 2020 10:31
React stack
/* eslint-disable global-require */
/* eslint-disable no-undef */
import { compose } from "redux";
import persistState from "redux-localstorage";
import { StoreEnhancer } from "redux";
import { routerMiddleware } from "connected-react-router";
import { createBrowserHistory } from "history";
import { createEpicMiddleware } from "redux-observable";
import { createStore, applyMiddleware } from "redux";
import rootEpic from "./epics";
@alfonsodev
alfonsodev / submitSignUpFormEpic.test.ts
Last active June 19, 2020 01:33
Attempting to test redux-observable epics in typescript
import { submitSignUpFormEpic } from "../epics";
import { TestScheduler } from "rxjs/testing";
import { FirebaseUser } from "../logic/User";
import { submitSignUpForm } from "../actions/authActions";
import { of, from } from "rxjs";
import { ActionsObservable, StateObservable } from "redux-observable";
import { Observable } from "redux";
import { map } from "rxjs/operators";
import { push } from "connected-react-router";
var fs = require("fs");
@alfonsodev
alfonsodev / ContentView.swift
Created April 4, 2020 17:52
SWiftUI example
//
// ContentView.swift
//
import AVFoundation
import SwiftUI
struct Track: Identifiable {
var id = UUID()
var title: String
@alfonsodev
alfonsodev / ItemList.js
Last active September 28, 2019 11:14
React Native Item list
import React, { Component } from "react";
import {
View,
StyleSheet,
TouchableHighlight,
Text,
SafeAreaView,
Alert
} from "react-native";
@alfonsodev
alfonsodev / FormValues.tsx
Created July 17, 2019 14:50
formik-yup-example
import React from 'react';
import { withStyles, WithStyles, createStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
const styles = () =>
createStyles({
root: {
padding: 5,
marginTop: 20,
},
@alfonsodev
alfonsodev / Audience.dart
Created May 11, 2019 09:39
flutter Agora.io broadcast
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:permission_handler/permission_handler.dart';
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
class Audience extends StatefulWidget {
@override
_AudienceState createState() => _AudienceState();
}
@alfonsodev
alfonsodev / how-to-copy-aws-rds-to-local.md
Created May 7, 2019 03:43 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@alfonsodev
alfonsodev / WaitForCommand.php
Created January 14, 2019 11:24
Wait for is useful for docker images
<?php
namespace App\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use App\Service\CacheService;
class WaitForCommand extends ContainerAwareCommand