Skip to content

Instantly share code, notes, and snippets.

View judgej's full-sized avatar

Jason Judge judgej

View GitHub Profile
@davestewart
davestewart / gulpfile.js
Last active October 7, 2018 10:03
Laravel Gulp setup - compiles scripts & styles (plus custom paths and live build option) with live-reload
// ---------------------------------------------------------------------------------
// libs
var gulp = require('gulp'),
// tools
sass = require('gulp-sass'),
uglify = require('gulp-uglify'),
sourcemaps = require('gulp-sourcemaps'),
livereload = require('gulp-livereload'),
@carbontwelve
carbontwelve / BasicWebAuth.php
Created November 3, 2015 16:33
BasicAuth Middleware Laravel/Lumen
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
class BasicWebAuth
{
/**
* Name of the realm
*
<?php
$stream = new GuzzleHttp\Psr7\MultipartStream([['name' => 'some-file', 'contents' => 'the contents']]);
$client = new GuzzleHttp\Client();
$r = $client->request('POST', 'http://httpbin.org/post', ['body' => $stream]);
$r->getBody()->getContents();
=> """
{\n
"args": {}, \n
"data": "", \n
"files": {}, \n
@taviroquai
taviroquai / ParseGeoPackage.php
Created May 8, 2016 17:58
PHP parse GeoPackage
<?php
/**
* Parse GeoPackageBinaryHeader
*
* References
*
* http://www.geopackage.org/spec/#gpb_spec
*
* https://en.wikipedia.org/wiki/Well-known_text
@Lemmings19
Lemmings19 / readme.md
Last active June 20, 2019 09:03
Set up Laravel 5.4 in an Ubuntu VM on Windows

To setup Laravel inside an Ubuntu virtual machine on Windows

Tested on Windows 10. Probably works in 7 and 8. I wrote this after I went through all of it, so let me know if I forgot a step.

In this guide:

  • VirtualBox (allows you to run a Linux operating system such as Ubuntu while you are running Windows)
  • Ubuntu 16.04 64 (a user friendly Linux installation that will be supported for many years)
  • LAMP stack (Linux, Apache, MySQL, PHP - all of the things that you will run your web application on)
  • Composer (this just manages your PHP dependencies, such as Laravel)
@joseluisq
joseluisq / 1README.md
Last active January 3, 2022 13:22
Configure PHP Lumen 5 HTTP Exception Handlers with common JSON responses.

Lumen 5 HTTP Exception Handlers with JSON support.

Configure PHP Lumen 5 HTTP Exception Handlers with common JSON responses.

image

Setup

Copy (replace) only the attached files to their respective directories. app/Exceptions/Handler.php and app/Http/Middleware/Authenticate.php

@chunter
chunter / pageant-autoload-keys-at-startup.txt
Created June 20, 2017 10:51
Make Pageant autoload keys at startup
To make Pageant automatically run and load keys at startup:
- Find the location of pageant.exe
- Windows key + R to open the 'run' dialog box
- Type: 'shell:startup' in the dialog box
- Create a shortcut to the pageant.exe and put into this startup folder.
@judgej
judgej / setphp
Last active January 24, 2020 17:28
bash script to switch between PHP versions in Plesk
#!/bin/bash
# Use the script like this:
# . setphp 7.1
# or
# source setphp 5.6
#
# It will look for the path to the current PHP version in your PATH and switch to
# the new PHP version.
# If you do not have a path to a php version, then it will add one.
@brunogaspar
brunogaspar / macro.md
Last active September 3, 2026 21:55
Recursive Laravel Collection Macros

What?

If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.

Setup

@kinlane
kinlane / health-check-response-format-for-http-apis.json
Created January 19, 2018 15:52
Health Check Response Format for HTTP APIs
{
"serviceID": "service:authz",
"description": "health of authz service",
"status": "pass",
"version" : "1",
"release_id" : "1.2.2",
"memory": [4096, 1024, 3456],
"cpu": [20, 40, 50],
"uptime": "1209600.245",
"connections" : 25,