Skip to content

Instantly share code, notes, and snippets.

#
# 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)
#
@ujackson
ujackson / Install-php7.md
Created May 24, 2016 22:42 — forked from hollodotme/Install-php7.md
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@ujackson
ujackson / Artisan.php
Created August 7, 2016 12:31
Laravel Cheat Sheet
php artisan --help OR -h
php artisan --quiet OR -q
php artisan --version OR -V
php artisan --no-interaction OR -n
php artisan --ansi
php artisan --no-ansi
php artisan --env
// -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
php artisan --verbose
@ujackson
ujackson / Plugin.php
Created August 17, 2016 18:55 — forked from vojtasvoboda/Plugin.php
Extend backend form in OctoberCMS
<?php
public function boot()
{
// Extend all backend form usage
Event::listen('backend.form.extendFields', function($widget) {
// Only for the Posts controller
if (!$widget->getController() instanceof \RainLab\Blog\Controllers\Posts)
return;
@ujackson
ujackson / DB.sql
Created October 12, 2016 15:26 — forked from msurguy/DB.sql
Dynamic dropdown in Laravel, let's say you have multiple drop downs (selects), you click on one and the contents of the other need to be dynamically changed. One solution is to dynamically load JSON from the API and change the dropdown dynamically depending on the user choice.
CREATE TABLE `makers` (
`id` int(10) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
@ujackson
ujackson / Install composer on Amazon AMI running on EC2
Created December 11, 2016 14:44 — forked from asugai/Install composer on Amazon AMI running on EC2
Install composer on Amazon AMI running on EC2
$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install
@ujackson
ujackson / PaystackCharge.php
Last active May 18, 2017 15:23 — forked from ibrahimlawal/PaystackFees.php
A php class to add paystack's local charge to a transaction total. Totally flops if the user pays with a foreign card.
<?php
class PaystackCharge{
public $percentage;
public $additional_charge;
public $crossover_total;
public $cap;
public $charge_divider;
public $crossover;
'routes' => array(
'login' => array('middleware' => ['web']),
'admin' => array('middleware' => ['web', 'auth']),
'account' => array('middleware' => ['web', 'auth']),
'default' => array('middleware' => ['web']),
'confirm' => array('middleware' => ['web']),
'update' => array(),
),
'page' => array(
@ujackson
ujackson / select2-override.css
Created October 16, 2017 14:04 — forked from andrewbranch/select2-override.css
Flat styling of select2.
.select2-container .select2-choice {
height: 34px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
background-color: #fff;
background-image: none;
background: #fff;
}
@ujackson
ujackson / controller.php
Created October 16, 2017 17:04 — forked from gormus/controller.php
Geospatial sort by distance using Laravel 4 and MySQL. I'm using a point column named geolocation in a table called meetings.
<?php
class MeetingsController extends \BaseController {
/**
* Display a listing of the resource.
* GET /meetings
*
* @return Response
*/