Skip to content

Instantly share code, notes, and snippets.

View abimaelmartell's full-sized avatar

Abimael Martell abimaelmartell

View GitHub Profile
axios.interceptors.response.use(
(response) => response,
(error) => {
if (defaultAxios.isAxiosError(error)) {
throw new Error(
`Failed Request to ${error.config.url} with ${JSON.stringify(
error.config.data
)} with status ${error.response?.status} and data ${JSON.stringify(
error.response?.data
ffmpeg -i input.mov -q:v 1 -q:a 1 output.wmv
@abimaelmartell
abimaelmartell / closestNumbers.js
Created March 13, 2021 00:23
Given an array of distinct integers, determine the minimum absolute difference between any two elements. Return all element pairs with that minimal absolute difference in ascending order.
/*
* Complete the 'closestNumbers' function below.
*
* The function accepts INTEGER_ARRAY numbers as parameter.
*/
const closestNumbers = (numbers) => {
let result = [];
let minimalDistance = Infinity;
numbers.sort((a, b) => a - b);
@abimaelmartell
abimaelmartell / FantasticFour.java
Last active February 15, 2021 03:32
Clase para Tarea de Programación Orientada a Objetos
import learning.business.superAnimals.ElasticHuman;
import learning.business.superAnimals.HomoSapiens;
import learning.business.superAnimals.Superman;
import learning.business.superAnimals.Invisible;
import learning.basicGUI.BaseAppGUI;
import learning.basicGUI.ImagePanel;
import learning.basicGUI.InternalButton;
import learning.basicGUI.FlowPanel;
import learning.basicGUI.GridPanel;
import java.awt.TextArea;
@abimaelmartell
abimaelmartell / 🍝.php
Created January 28, 2021 06:07
Ejemplo de Espaghetti
<?php
$servername = "127.0.0.1";
$username = "user";
$password = "password";
$dbname = "db";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
@abimaelmartell
abimaelmartell / Dockerfile
Created March 31, 2020 21:01
Docker for Rails
FROM ruby:2.7.0-alpine
ENV PORT=80
RUN apk add --no-cache \
build-base \
libxml2-dev \
libxslt-dev \
postgresql-dev \
tzdata
@abimaelmartell
abimaelmartell / gh-pages.yml
Created February 13, 2020 19:08
Deploy Slate Documentation to Github Pages using Github Actions
name: Github Pages Build
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
@abimaelmartell
abimaelmartell / default_gateway.go
Created October 19, 2016 18:52
Get default gateway by parsing RIB information using the net/route package. BSD Only.
package main
import (
"fmt"
"golang.org/x/net/route"
)
var defaultRoute = [4]byte{0, 0, 0, 0}
func main() {
@abimaelmartell
abimaelmartell / ruby process debug.md
Last active June 15, 2016 21:20
Debug a memory leak, or a hanging process on a rails application.

Attach the process to a gdb session.

sudo gdb $(rbenv which ruby) $(pgrep thin)

Enter this on the gdb prompt.

set $ary = (int)backtrace(-1)
@abimaelmartell
abimaelmartell / Makefile
Last active January 1, 2016 11:49
ejdb example
all:
gcc main.c -o main -ltcejdb -std=c99 -Wall -fPIC -pedantic -O2