Skip to content

Instantly share code, notes, and snippets.

View aazbeltran's full-sized avatar
💻
Writing Code..

Alonso ZB aazbeltran

💻
Writing Code..
View GitHub Profile
@aazbeltran
aazbeltran / STANDARD_DEVIATION.groovy
Created March 4, 2024 19:47
Jetbrains scripting
import static java.math.MathContext.DECIMAL128
def toBigDecimalFunc = { value ->
value instanceof Number ? value as BigDecimal :
value.toString().isBigDecimal() ? value.toString() as BigDecimal :
null
}
def valuesList = []
@aazbeltran
aazbeltran / macos-terminal-close-notifications
Created June 22, 2021 02:09 — forked from gaddoz/macos-close-notifications
close all disk not ejected properly and other notifications
killall NotificationCenter
{{--
Icon view component for Laravel 7.
@disclaimer The icons used in this component are taken from "Refactoring UI Heroicons" (md-outline collection).
For more info https://github.com/refactoringui/heroicons by Steve Schoger & Adam Wathan.
@copyright MIT
@author Maurizio <https://twitter.com/mauriziolepora>
@aazbeltran
aazbeltran / ejemplo.html
Created July 13, 2020 21:26
Ejemplo rápido para Instituto Birmingham de como implementar la funcionalidad de atrasar o adelantar un audio en HTML con JS
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
</script>
<audio controls autoplay src="https://upload.wikimedia.org/wikipedia/commons/6/6e/Micronesia_National_Anthem.ogg"></audio>
<input type="button" id="atrasar" value="Atrasar"><input type="button" id="adelantar" value="Adelantar"><input type="button" id="play" value="Reproducir/Detener">
<script>
var audio = $("audio")[0];
$(document).keydown(function(e) {
var unicode = e.charCode ? e.charCode : e.keyCode;
switch (unicode) {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aazbeltran
aazbeltran / HandlePutFormData.php
Last active May 27, 2019 13:58 — forked from iamntz/HandlePutFormData.php
Laravel: Middleware to support multipart/form-data in PUT, PATH and DELETE requests. Deals with one level of form arrays.
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* @author https://github.com/aazbeltran
*
@aazbeltran
aazbeltran / RandomPointsInPolygon.sql
Created May 16, 2018 00:15
Generación de punto aleatorio en un radio de 250m de un punto inicial
CREATE OR REPLACE FUNCTION RandomPointsInPolygon(geom geometry, num_points integer)
RETURNS SETOF geometry AS
$BODY$DECLARE
target_proportion numeric;
n_ret integer := 0;
loops integer := 0;
x_min float8;
y_min float8;
x_max float8;
y_max float8;
@aazbeltran
aazbeltran / jquery.dataTables.min.js
Created March 9, 2017 20:36
dataTables for C# Ajax
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],function(b){return a(b,window,document)}):"object"==typeof exports?module.exports=function(b,c){return b||(b=window),c||(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c,b,b.document)}:a(jQuery,window,document)}(function(a,b,c,d){"use strict";function B(b){var d,e,c="a aa ai ao as b fn i m o s ",f={};a.each(b,function(a,g){d=a.match(/^([^A-Z]+?)([A-Z])/),d&&c.indexOf(d[1]+" ")!==-1&&(e=a.replace(d[0],d[2].toLowerCase()),f[e]=a,"o"===d[1]&&B(b[a]))}),b._hungarianMap=f}function C(b,c,e){b._hungarianMap||B(b);var f;a.each(c,function(g,h){f=b._hungarianMap[g],f===d||!e&&c[f]!==d||("o"===f.charAt(0)?(c[f]||(c[f]={}),a.extend(!0,c[f],c[g]),C(b[f],c[f],e)):c[f]=c[g])})}function D(a){var b=e.defaults.oLanguage,c=a.sZeroRecords;!a.sEmptyTable&&c&&"No data available in table"===b.sEmptyTable&&kb(a,a,"sZeroRecords","sEmptyTable"),!a.sLoadingRecords&&c&&"Loading..."===b.sLoadingRecords&&kb(a,a,"sZeroRecords","sLoadin
@aazbeltran
aazbeltran / edad.js
Created January 4, 2017 20:30
Calcular edad para David
var fechaNacimiento = new Date("1995-06-02");
function edad(fechaNacimiento) {
var diff = Math.floor(new Date().getTime() - fechaNacimiento.getTime());
var dia = 1000 * 60 * 60 * 24;
var dias = Math.floor(diff / dia);
var meses = Math.floor(dias / 31);
var anio = Math.floor(meses / 12);
return anio;
}
@aazbeltran
aazbeltran / index.js
Created September 10, 2016 19:07
Obtener uri handler con bundle id de AppStore
var bundles=["net.whatsapp.WhatsApp"];
bundles.map(function(bundle){
$.getJSON( "http://itunes.apple.com/lookup?country=mx&bundleId="+bundle, function(res) {
if(res.resultCount==0){
console.log("404 - "+bundle);
return;
}
console.log(res.results[0].trackViewUrl.replace("https","itms-apps"));