Skip to content

Instantly share code, notes, and snippets.

View acabreragnz's full-sized avatar

Toni Cabrera acabreragnz

  • Bixlabs
  • Montevideo, Uruguay
View GitHub Profile
#!/bin/bash
# This script, named generate-pr-report.sh, generates a Markdown report of pull requests for specified GitHub users and date ranges within a GitHub project.
# It must be executed within the root directory of the project you want to analyze.
#
# Usage:
# ./generate-pr-report.sh "user1,user2" "2024-02,2024-03"
# This command generates a report for pull requests created by user1 and user2 between February 2024 and March 2024.
#
# ./generate-pr-report.sh "user1"
@acabreragnz
acabreragnz / compraPesosMediaBrou.js
Last active June 9, 2023 01:15
Este script te permite convertir una cantidad de dólares a pesos UY, utilizando el valor del dólar actual a la media, obtenido de la pagina de ebrou cotizaciones. https://www.brou.com.uy/cotizaciones
(function () {
const selectorToFloat = (selector) => parseFloat(document.querySelector(selector).textContent.trim().replace(',', '.'));
const floatToLocaleString = (number) => number.toLocaleString('es-UY', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
const dolares = prompt('¿Cuántos dólares desea comprar?');
const compra = selectorToFloat('table > tbody > tr:nth-child(2) > td:nth-child(3)');
const venta = selectorToFloat('table > tbody > tr:nth-child(2) > td:nth-child(5)');
const media = parseFloat(((compra + venta) / 2).toFixed(2));
const pesos = parseFloat((dolares * media).toFixed(2));
document.write('<link rel="stylesheet" href="https://github.githubassets.com/assets/gist-embed-39872b2714d6.css">')
document.write('<div id=\"gist116784020\" class=\"gist\">\n <div class=\"gist-file\" translate=\"no\">\n <div class=\"gist-data\">\n <div class=\"js-gist-file-update-container js-task-list-container file-box\">\n <div id=\"file-zendesk-form-builder-js\" class=\"file my-2\">\n \n <div itemprop=\"text\" class=\"Box-body p-0 blob-wrapper data type-javascript \">\n\n \n<div class=\"js-check-bidi js-blob-code-container blob-code-content\">\n\n <template class=\"js-file-alert-template\">\n <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n <path fill-rule=\"evenodd\" d=\"M8.22 1.754a.25.25 0 00-.44 0L1.698 13.132a.25.25 0 00.22.368h12.164a.25.25 0 00.22-.368L8.22 1.
document.addEventListener('DOMContentLoaded', function() {
console.log('loading zendesk form builder');
let REPORT_BUG_ARTICLE_ID = '6509556532759';
let REPORT_BUG_TICKET_ID = '6504444995991';
let CONTACT_US_ARTICLE_ID = '6510266315671';
let CONTACT_US_TICKET_ID = '5754824917015';
let FORM_PARENT_ID = 'request-form';
@acabreragnz
acabreragnz / auth.ts
Created March 18, 2020 00:55
Authentication in Nestjs using JWT and Local strategires
# src/api/auth/passport/jwt.strategy.ts
import { ExtractJwt, Strategy } from 'passport-jwt';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import { ConfigService } from 'src/api/config/config.service';
import { UsersProvider } from 'src/api/users/users.provider';
import { JwtService } from '@nestjs/jwt';
@Injectable()
@acabreragnz
acabreragnz / embed-code.js
Created July 16, 2019 20:49
Simple example about creating embed code
// index.html
// embed code
<script type="text/javascript" id="hs-script-loader" async defer src="//online-script.com/script-loader/XXXX.js"></script>
// online-script.com/script-loader/XXXX.js
(function (id, src) {
if (document.getElementById(id)) { return; }
var js = document.createElement('script');
js.src = src;
js.type = 'text/javascript';
@acabreragnz
acabreragnz / crypto_system.ex
Last active November 10, 2017 16:35
Caesar Cipher, using a different key for each different word (key_seed for word in first place, key_seed + 1 for word in second_place, ...). Also we have a force brute function to find the possible keys
defmodule CryptoSystem do
def encrypt(text, key_seed) do
words = String.split(text, " ");
words
|> Enum.with_index()
|> Enum.map(&encrypt_word(&1, key_seed))
|> Enum.join(" ")
end
@acabreragnz
acabreragnz / rps.ex
Last active October 25, 2017 01:33
Rock Scissors Paper game in Elixir! (remember to wrap this inside a module)
@weapons ~w(rock scissors paper)a
def rps(user_choice) when is_binary(user_choice), do: is_valid_choice(String.to_atom(user_choice))
def rps(user_choice) when is_atom(user_choice), do: is_valid_choice(user_choice)
def rps(user_choice), do: {:lost, "Invalid type!"}
defp is_valid_choice(user_choice) when user_choice in @weapons, do: time_to_play(user_choice)
defp is_valid_choice(user_choice), do: {:lost, "Invalid choice!"}
defp time_to_play(user_choice) do
@acabreragnz
acabreragnz / select_distance_knex.js
Last active September 30, 2020 16:37
This module extends the knex query builder with selectDistance method, the method adds a virtual column to the current query (qb) with the alias as, in which resides the calculated distance from the geoPoint to the entity.location column. It also accepts some options parameters like the unit (km | mi) and the decimalPrecision of the result. Deps…
var knex;
/**
* This module extends the knex query builder with selectDistance method,
* The method adds a virtual column to the current query (qb) with the alias as, in which
* resides the calculated distance from the geoPoint to the entity.location column.
* It also accepts some options parameters like the unit (km | mi) and the decimalPrecision of the result.
* Deps: Postgis
* @example
@acabreragnz
acabreragnz / load-hours.js
Created November 22, 2016 15:22
All the hours in a day in 12-hour clock format with a defined inverval
/**
* All the hours in a day in 12-hour clock format with a defined inverval
*
* @example
* // returns [
* '12:00 AM',
* '12:15 AM',
* '12:30 AM',
* '12:45 AM',
* '01:00 AM',