Posts

Showing posts from August, 2016

Access Laravel Session Outside Laravel

Image
I was curious if this was possible. I had a scenario that I wanted access an active Laravel session OUTSIDE Laravel.

BGTS LDAP Authentication Module

Image
A simple LDAP authentication module for Laravel using Caffeinated Module and Angular JS Checks if a username is registered in an LDAP collection. Replaces the default Laravel Authentication.    

Microsoft Excel's Networkdays on Javascript

Here is a small snippet I made to do Networkdays function of MS Excel in Javascript. networkdays = function (startDate,endDate){ var startDate = typeof startDate=='object' ? startDate: new Date (startDate); var endDate = typeof endDate=='object' ? endDate: new Date (endDate); if (endDate > startDate){ var days = Math .ceil((endDate.setHours(23,59,59,999) - startDate.setHours(0,0,0,1)) / (86400 * 1000)); var weeks = Math .floor( Math .ceil((endDate.setHours(23,59,59,999) - startDate.setHours(0,0,0,1)) / (86400 * 1000)) / 7); days = days - (weeks * 2); days = startDate.getDay() - endDate.getDay() > 1 ? days - 2 : days; days = startDate.getDay() == 0 && endDate.getDay() != 6 ? days - 1 : days; days = endDate.getDay() == 6 && startDate.getDay() != 0 ? days - 1 : days; return days; } return null ; }; Usage: networkdays('08/05/2016','08/30/2016'); OR networkdays(new Date(), '08/30/2016'); Acce