Skip to content

Instantly share code, notes, and snippets.

View nallegrotti's full-sized avatar

Nicolás Allegrotti nallegrotti

  • Recargapay
  • Buenos Aires
View GitHub Profile
@nallegrotti
nallegrotti / gist:53be48ac3be1521d0e3c4fba573e0b3d
Last active August 31, 2018 19:07
El dolar en su terminal
alias dolar="curl 'www.dolarhoy.com' 2>/dev/null | grep 'Compra <span ' | sed 's/.*\\\$/\\\$/' | sed 's/<\\/span.*//'"
@nallegrotti
nallegrotti / gist:c09204e0d65a5dc207f3
Created March 25, 2015 19:29
Calculo de Días hábiles entre 2 fechas (no incluye feriados)
import groovy.time.TimeCategory
/// Magia
def weekendDays(from, to){
use(groovy.time.TimeCategory){
def d = (to - from).days
def w = d/7 as Integer
def toWD = to[Calendar.DAY_OF_WEEK]
def fromWD = from[Calendar.DAY_OF_WEEK]
java.lang.Math.min(w * 2 + (fromWD > toWD ? 2 : (toWD == 7 ? 1:0) + (fromWD == 1 ? 1:0)), d)