Skip to content

Instantly share code, notes, and snippets.

View proshanto's full-sized avatar

Proshanta Barman proshanto

  • Brain Station 23 PLC
  • Dhaka, Bangladesh
View GitHub Profile
## 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"

How to create Swap on Linux / Ubuntu

Enable swap

sudo swapon -s

Create a 2GB file

sudo dd if=/dev/zero of=/swapfile bs=1024 count=2048k

@proshanto
proshanto / .vimrc
Last active August 29, 2015 14:08 — forked from JeffreyWay/.vimrc
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
@proshanto
proshanto / gist:5469831b41db9bd32fc7
Last active August 29, 2015 14:18
Laravel 5 Codeception Acceptance Testing Environment Setup
/*
* 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')
@proshanto
proshanto / DB.sql
Last active August 29, 2015 14:19 — forked from msurguy/DB.sql
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.

Installation

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