Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@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 / function.php
Created March 18, 2019 04:24
WordPress Snippets
<?php
/**
* Disables WordPress Rest API for external requests
*/
function restrict_rest_api_to_localhost() {
$whitelist = array('127.0.0.1', "::1");
if(!in_array($_SERVER['REMOTE_ADDR'], $whitelist)){
die('REST API is disabled.');
@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=*
@sicaboy
sicaboy / flexbox.less
Last active March 2, 2018 04:49
mixins.less
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
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"