Skip to content

Instantly share code, notes, and snippets.

@nickdavies791
nickdavies791 / .bash_aliases
Last active Nov 9, 2020
Linux Install Script - Web Dev
View .bash_aliases
# Directory Aliases
alias code="cd $HOME/Code"
# Laravel Aliases
alias art="php artisan"
alias migrate="php artisan migrate"
alias rollback="php artisan migrate:rollback --step=1"
alias seed="php artisan db:seed"
alias nfactory="php artisan make:factory"
alias ntest="php artisan make:test"
@nickdavies791
nickdavies791 / mailing_list.sql
Last active Feb 21, 2020
Concatenates all email addresses of active users from table into mailing list
View mailing_list.sql
WITH
email_list (concatenated_emails)
AS
(
SELECT
ADDEML_0 + ';'
FROM
AUTILIS
WHERE
ENAFLG_0 = 2
@nickdavies791
nickdavies791 / suppliers_with_first_orders.sql
Created Feb 10, 2020
A list of suppliers with the date of their first order
View suppliers_with_first_orders.sql
----------------------------------------
/**
*
* All suppliers that have had an order
* raised for them.
*
*/
----------------------------------------
WITH order_list AS (
SELECT
View orders_raised_by_cpy.sql
----------------------------------------
/**
*
* Returns number of purchase orders
* raised this period per company.
*
*/
----------------------------------------
WITH
orders_by_company (company, order_count)
View ZGENT.src
#########################################################
##
## Uploads a file to a given folder and renames.
##
#########################################################
Funprog UPLOAD_FILE_AND_RENAME(TEMPDIR, FILDIR, FILNAM, NEWNAM)
Variable Char TEMPDIR, FILDIR, FILNAM, NEWNAM
Local Integer COPYSTA
Local Integer MOVESTA
@nickdavies791
nickdavies791 / VAT.sql
Created Oct 25, 2019
Fetches invoice data for Malta VAT Return
View VAT.sql
----------------------------------------
/**
*
* Returns Malta VAT Information.
*
*/
----------------------------------------
SELECT
poh.POHNUM_0 AS order_number,
@nickdavies791
nickdavies791 / Orders.sql
Created Oct 25, 2019
Returns unsigned purchase orders over given date
View Orders.sql
----------------------------------------
/**
*
* Returns unsigned POs over x days old
*
* ORDDAT (Order date) <= 'xxx'
* APPFLG (Signed) < 3 (No/Partly)
* CLEFLG (Closed) <> 2 (No)
* FLGSIG (Signature) = 3 (To be signed)
*
@nickdavies791
nickdavies791 / phpunit.xml
Created Apr 1, 2019
Useful snippet in PHPUnit to show which line caused the test to fail
View phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
@nickdavies791
nickdavies791 / AddUserIdToRequest.php
Last active Apr 1, 2019
Merging the current user ID to the request in Laravel using web middleware
View AddUserIdToRequest.php
<?php
<?php
namespace App\Http\Middleware;
use Closure;
class MergeUserIdIntoRequest
{
@nickdavies791
nickdavies791 / PagesController.php
Last active Apr 1, 2019
Using the __invoke method for dynamic view rendering in Laravel
View PagesController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PagesController extends Controller
{
/**
* Return the requested view.
You can’t perform that action at this time.