Skip to content

Instantly share code, notes, and snippets.

View juuliaans's full-sized avatar

Julián Santa Ana juuliaans

View GitHub Profile
const getURL = year => `https://nolaborables.com.ar/api/v2/feriados/${year}`
const months = ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
const days = ['Domingo', 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado'];
const dayOfWeek = (day, month, year) => days[new Date(year, month, day).getDay()];
const getYear = () => (new Date()).getFullYear();
const getNextHoliday = function(holidays){
const now = new Date()
@juuliaans
juuliaans / backbone-route-builder.js
Last active December 19, 2015 23:29
URL builder for Backbone-like router.
resolveURL: function (route, params, appendRoot) {
var appendRoot = (appendRoot == false) ? false : true;
var route, params;
var href = "";
var regExpAllNormalParams = /(\(\?)?\/:\w+/g;
var regExpAllOptionalParams = /\((.*?)\)/g;
href = router.routes[route];
@juuliaans
juuliaans / gist:5161133
Created March 14, 2013 13:05
Code to delegate every href= on the html to the backbone router.
// All navigation that is relative should be passed through the navigate
// method, to be processed by the router. If the link has a `data-bypass`
// attribute, bypass the delegation completely.
$(document).on("click", "a[href]:not([data-bypass])", function (evt) {
// Get the absolute anchor href.
var href = { prop: $(this).prop("href"), attr: $(this).attr("href") };
// Get the absolute root.
var root = location.protocol + "//" + location.host + app.root;
// Ensure the root is part of the anchor href, meaning it's relative.