Skip to content

Instantly share code, notes, and snippets.

View sicaboy's full-sized avatar
🌏

SLJ sicaboy

🌏
  • Sydney, Australia
View GitHub Profile
@sicaboy
sicaboy / railway_station.csv
Created June 27, 2020 11:32 — forked from jenosan/railway_station.csv
Railway Station
NAME Lat Lon
Aberdeen Station -32.16710358 150.8920522
Adamstown Station -32.93372988 151.7200807
Albion Park Station -34.56264671 150.7984997
Allawah Station -33.96958391 151.11433
Arncliffe Station -33.93645619 151.1472995
Artarmon Station -33.80890264 151.1852939
Ashfield Station -33.88755061 151.1255042
Asquith Station -33.68876996 151.1080252
Auburn Station -33.8492696 151.032867
@sicaboy
sicaboy / HandlePutFormData.php
Created September 23, 2019 23:59 — 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/Stunext
*
* PHP, and by extension, Laravel does not support multipart/form-data requests when using any request method other than POST.
@sicaboy
sicaboy / HandlePutFormData.php
Created September 23, 2019 23:59 — 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/Stunext
*
* PHP, and by extension, Laravel does not support multipart/form-data requests when using any request method other than POST.
@sicaboy
sicaboy / .env.travis
Created April 17, 2018 02:17 — forked from qWici/.env.travis
Laravel 5.5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
@sicaboy
sicaboy / homebridge
Created December 22, 2017 11:35 — forked from johannrichard/homebridge
Systemd Service for homebridge (http://github.com/nfarina/homebridge)
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String {
let calendar = NSCalendar.currentCalendar()
let unitFlags = NSCalendarUnit.CalendarUnitMinute | NSCalendarUnit.CalendarUnitHour | NSCalendarUnit.CalendarUnitDay | NSCalendarUnit.CalendarUnitWeekOfYear | NSCalendarUnit.CalendarUnitMonth | NSCalendarUnit.CalendarUnitYear | NSCalendarUnit.CalendarUnitSecond
let now = NSDate()
let earliest = now.earlierDate(date)
let latest = (earliest == now) ? date : now
let components:NSDateComponents = calendar.components(unitFlags, fromDate: earliest, toDate: latest, options: nil)
if (components.year >= 2) {
return "\(components.year) years ago"