Skip to content

Instantly share code, notes, and snippets.

View RichardStyles's full-sized avatar

Richard Styles RichardStyles

View GitHub Profile
@RichardStyles
RichardStyles / JsonResponse.php
Last active May 26, 2016 18:31
Middleware for PHP Slim framework 3.x to output JSON responses with the correct header. Probably a better way to do this then just simply interrogating the response body, but for a initial test sufficient for my needs.
<?php
/**
* Middleware to set correct header for JSON output.
* Very basic initial version, simply checks the body of the response to see if it is valid JSON.
* If response is not JSON then continues with default settings.
* If response is JSON then header is updated.
*
* @author Richard Styles
*/
namespace App\Middleware;
@RichardStyles
RichardStyles / CKeditor.js
Last active April 19, 2018 09:39
ExtJS 5 component to hold CKEditor (web text editor) from http://ckeditor.com/
Ext.define('Ext.ux.CKeditor', {
extend: 'Ext.form.field.TextArea',
alias: 'widget.ckeditor',
defaultListenerScope: true,
listeners: {
instanceReady: 'instanceReady',
resize: 'resize',
boxready : 'onBoxReady'
@RichardStyles
RichardStyles / vagrant-bootstrap.sh
Last active September 22, 2015 21:46
Vagrant bootstrap
#!/usr/bin/env bash
echo "Starting Bootstrap"
echo "Running update..."
yum update
echo "Installing requirements.."
yum -y install httpd php
echo "setup HTML dir"
rm -rf /var/www/html
@RichardStyles
RichardStyles / vagrant-VagrantFile
Created September 22, 2015 21:49
VagrantFile - base for Centos/7
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
#
# REQUIRES:
# - server (the forge server instance)
# - site_name (the name of the site folder)
# - sudo_password (random password for sudo)
# - db_password (random password for database user)
# - event_id (the provisioning event name)
# - callback (the callback URL)
#

Keybase proof

I hereby claim:

  • I am richardstyles on github.
  • I am styles (https://keybase.io/styles) on keybase.
  • I have a public key ASAGE_lIU_glgK27tOjJULyRVPj-9Hf8FRT8ifC8s3nnswo

To claim this, I am signing this object:

@RichardStyles
RichardStyles / _myapp-buttons.scss
Created June 16, 2016 14:56 — forked from homeyer/_myapp-buttons.scss
ExtJS green button component UI definition
@include extjs-button-ui(
/* UI + Scale */
'green-small',
$border-radius: $button-small-border-radius,
$border-width: $button-small-border-width,
$border-color: green,
$border-color-over: green,
$border-color-focus: green,
@RichardStyles
RichardStyles / UserObserver.php
Last active February 11, 2018 11:08
Laravel Observer template
<?php
namespace App\Observers;
use App\User;
class UserObserver
{
/**
@RichardStyles
RichardStyles / unifi-import-cert.sh
Created January 23, 2019 13:34
Mirror for certbot script for ubiquity unifi controller
#!/bin/bash
# Author: Frank Gabriel, 01.01.2019
# Credits Kalle Lilja, @SprockTech and others
# Script location: /etc/letsencrypt/renewal-hooks/post/unifi-import-cert.sh (important for auto renewal)
# Tested with Debian 9 and UniFi 5.8.28, 5.9.22 and 5.9.32 - should work with any recent Unifi and Ubuntu/Debian releases
#************************************************
#******************Instructions******************
#************************************************
@RichardStyles
RichardStyles / unifi-import-cert.sh
Created January 23, 2019 13:34
Mirror for certbot script for ubiquity unifi controller
#!/bin/bash
# Author: Frank Gabriel, 01.01.2019
# Credits Kalle Lilja, @SprockTech and others
# Script location: /etc/letsencrypt/renewal-hooks/post/unifi-import-cert.sh (important for auto renewal)
# Tested with Debian 9 and UniFi 5.8.28, 5.9.22 and 5.9.32 - should work with any recent Unifi and Ubuntu/Debian releases
#************************************************
#******************Instructions******************
#************************************************