Skip to content

Instantly share code, notes, and snippets.

View midnite81's full-sized avatar

Simon Rogers midnite81

View GitHub Profile
@midnite81
midnite81 / change_log_live_template
Last active June 20, 2020 23:03
A change log template
## [$VERSION$] - $DATE$
### Added
- None
### Changed
- None
### Depreciated
- None
### Removed
- None
### Fixed
@midnite81
midnite81 / install.sh
Created January 17, 2018 06:29 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@midnite81
midnite81 / .aliases_laravel
Created November 12, 2017 20:34
Laravel Aliases
alias pa='php artisan'
alias pao='php artisan optimize'
pa.auth() {
php artisan make:auth $*
}
pa.command() {
php artisan make:command $*
}
pa.controller() {
@midnite81
midnite81 / remove_value_from_array.php
Created October 30, 2017 12:43
Remove a value from an array
<?php
/**
* Remove a value from an array
*
* @param $valueToRemove
* @param $array
* @return bool
*/
function array_remove_value($valueToRemove, $array) {
@midnite81
midnite81 / Accounting.php
Last active June 20, 2020 23:02
A small accounting class for demonstration
<?php
namespace App\Services;
class Accounting
{
/**
* Calculate the margin
*
* @param $buyAtFigure
@midnite81
midnite81 / englishDate.js
Last active June 20, 2020 23:01
A bit of javascript to see if a date is in English format or not
function checkEnglishDateJs(subject) {
var pattern = new RegExp('/([0-2]\d|3[0-1])\/(0\d|1[0-2])\/(20)\d{2}/');
return pattern.test(subject);
}
if (checkEnglishDateJs('01/02/2019')) {
alert('true');
} else {
alert('false');
}
@midnite81
midnite81 / package.json
Last active June 7, 2017 10:39
scripts needed for mix
"scripts": {
"dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
@midnite81
midnite81 / removeBuild
Last active April 11, 2017 22:40
Remove Build Folder and Duplicate Mixes.php
<?php
class removeBuild
{
protected $manifest = null;
protected $publicPattern = '/\/public\/(.*?)$/i';
public function __construct()
{
@midnite81
midnite81 / Make columns nullable.sql
Last active June 20, 2020 23:00
An example of generating sql to make columns nullable
SELECT column_name, concat_ws(' ', 'ALTER TABLE `claims` MODIFY', concat('`',column_name,'`'), CASE WHEN (CHARACTER_MAXIMUM_LENGTH IS NULL) THEN data_type ELSE concat(data_type,'(', CHARACTER_MAXIMUM_LENGTH, ')') END, 'null;')
FROM information_schema.columns c
WHERE table_name = '<>' and table_schema = '<>'
@midnite81
midnite81 / Alter Table to InnoDB
Last active June 20, 2020 22:58
Create sql statements to change a table to use InnoDB
SELECT CONCAT('ALTER TABLE `', table_name, '` ENGINE=InnoDB;') AS sql_statements
FROM information_schema.tables AS tb
WHERE table_schema = @DATABASE_NAME
AND `ENGINE` = 'MyISAM'
AND `TABLE_TYPE` = 'BASE TABLE'
ORDER BY table_name DESC;