Skip to content

Instantly share code, notes, and snippets.

View midnite81's full-sized avatar

Simon Rogers midnite81

View GitHub Profile
@midnite81
midnite81 / .travis.yml
Created September 21, 2018 09:14
Default example of a travis yml file.
language: php
php:
- 7.0
- 7.1
before_script:
- travis_retry composer self-update
- travis_retry composer install --prefer-source --no-interaction --dev
@midnite81
midnite81 / phpunit.xml
Last active September 20, 2018 10:30
A default example of a phpunit file
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.5/phpunit.xsd"
bootstrap="./vendor/autoload.php"
forceCoversAnnotation="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true"
>
@midnite81
midnite81 / .laravel-make
Created September 19, 2018 15:23
A laravel-make config file template
## =====================================================================================================================
## Base Path
## =====================================================================================================================
## The base path that will be prepended to all files, excluding migrations and seeders.
## Defaults to /app
# BASE_PATH=/src
## =====================================================================================================================
## Base Namespace
@midnite81
midnite81 / lando-php54.yml
Last active June 20, 2020 23:22
Default Lando Config for PHP 5.4
name: <name>
recipe: laravel
config:
via: apache
webroot: public
php: '5.4'
proxy:
appserver:
- <site>.lndo.site
@midnite81
midnite81 / lando-php56.yml
Created September 10, 2018 12:53
Default Lando Config for PHP 5.6
name: <name>
recipe: laravel
config:
via: apache
webroot: public
php: '5.6'
proxy:
appserver:
- <site>.lndo.site
@midnite81
midnite81 / lando-php72.yml
Created September 10, 2018 12:53
Default Lando Config for PHP 7.2
name: <name>
recipe: laravel
config:
via: apache
webroot: public
php: '7.2'
proxy:
appserver:
- <site>.lndo.site
@midnite81
midnite81 / TableSizes.sql
Created August 21, 2018 16:24
Get the sizes of a table
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema = database()
ORDER BY (data_length + index_length) DESC;
@midnite81
midnite81 / lando-php71.yml
Created August 21, 2018 13:51
Default Lando Config for PHP 71
name: <name>
recipe: laravel
config:
via: apache
webroot: public
php: '7.1'
proxy:
appserver:
- <site>.lndo.site
@midnite81
midnite81 / remove_trailing_question_marks.sql
Last active June 20, 2020 22:56
An example of removing trailing question marks in SQL
UPDATE http_redirects_new
SET redirect_url = trim(trailing '?' FROM redirect_url)
WHERE redirect_url LIKE '%?'
@midnite81
midnite81 / only_update_if_not_null.php
Last active June 20, 2020 22:57
An example of updating values where a column is not null
<?php
// you should be escaping the values you pass to the SQL query
if (! empty($first_name)) {
$sql = "UPDATE `user` SET `u_first` = $first_name WHERE `id`='$uid' and u_first IS NOT NULL;";
// execute etc ..
}
// then you will need to do the same for the other fields