Enable swap
sudo swapon -s
Create a 2GB file
sudo dd if=/dev/zero of=/swapfile bs=1024 count=2048k
| ## Making a 32 bit version of Homestead | |
| # Clone the settler repository to a directory | |
| git clone https://github.com/laravel/settler.git Ubuntu32 | |
| # In that directory edit the file called "Vagrantfile" to use a ubuntu 32 box instead of the 64 bit one | |
| change this line: | |
| config.vm.box = "ubuntu/trusty64" |
| set nocompatible " Disable vi-compatibility | |
| set t_Co=256 | |
| colorscheme xoria256 | |
| set guifont=menlo\ for\ powerline:h16 | |
| set guioptions-=T " Removes top toolbar | |
| set guioptions-=r " Removes right hand scroll bar | |
| set go-=L " Removes left hand scroll bar | |
| set linespace=15 |
| * -A in SSH enables agent forwarding. | |
| * -p 2122 is not needed if you use the default port of 22. | |
| * Replace SSH_USER and example.com with your own values. | |
| * Example run: $ envoy run deploy_demo | |
| * --no-scripts because Laravel composer.json's post-install-cmd includes optimize, which is already done by php artisan dump-autoload | |
| @servers(['test' => '-A -p 2122 -l user test.example.com', 'prod' => '-A -p 2122 -l user example.com']) | |
| @task('install_test', ['on' => ['test']]) | |
| cd project |
| /* | |
| * file: bootstrap/app.php | |
| * | |
| * Set up environment 'testing' for codeception acceptance test | |
| * https://laracasts.com/discuss/channels/general-discussion/acceptance-tests-while-setting-the-environment-name | |
| * Main domain name is used-books.dev | |
| */ | |
| $app->detectEnvironment(function() | |
| { | |
| if (isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'test.used-books.dev') |
| 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; | |
| -- |
| git branch -m old_branch new_branch # Rename branch locally | |
| git push origin :old_branch # Delete the old branch | |
| git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
Note: Some of these shortcuts have been remapped for my own convenience (Preferences->Keymap). These are Mac shortcuts, just use the Windows/Linux equivalent of the Cmd/Option/Ctrl/Del keys.
####Search, Go to, Navigation ####
Cmd + P - Search file
Cmd + Shift + O - Search everywhere
(I swapped the above two recently because I use Cmd + P to search for files most of the time).
#Laravel 5 Simple ACL manager
Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.
If the user has a 'Root' role, then they can perform any actions.
Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php
| function cdProject() { | |
| projectDir="/var/www/projects" | |
| if [ $# -lt 2 ]; then | |
| echo -e "Argument #1 should be personal or work\n" | |
| echo -e "Argument #2 should be the name of the directory to cd into from personal or work directory." | |
| return 1 | |
| fi | |
| if [ $(pwd) != "$projectDir/$1/$2" ]; then |