Skip to content

Instantly share code, notes, and snippets.

Avatar

sicaboy sicaboy

  • Sydney, Australia
View GitHub Profile
View railway_station.csv
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 Sep 23, 2019 — 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.
View HandlePutFormData.php
<?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 Sep 23, 2019 — 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.
View HandlePutFormData.php
<?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 Mar 18, 2019
WordPress Snippets
View function.php
<?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 Apr 17, 2018 — forked from qWici/.env.travis
Laravel 5.5 Travis CI config
View .env.travis
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
View 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=*
View flexbox.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
View timeago.swift
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"
You can’t perform that action at this time.