Skip to content

Instantly share code, notes, and snippets.

View MwirabuaTimothy's full-sized avatar

Timothy Mwirabua MwirabuaTimothy

View GitHub Profile
@MwirabuaTimothy
MwirabuaTimothy / ubuntu_starter.md
Last active December 27, 2015 20:18
Starting up on Ubuntu

COMMANDS

replace [text in square blocks] with the right code snippets

ubuntu gain

speed, speed, speed
no viruses
open source juice
unix favors

become a guru swiftly

@MwirabuaTimothy
MwirabuaTimothy / laravel-4-environments.md
Last active August 29, 2015 14:27
Managing environment configurations on laravel 4 and keeping private keys from source control

On your local source code:

define environments in bootstrap/start.php

$env = $app->detectEnvironment(function(){
	return gethostname() == 'blackpearl' ? 'production' : 'local';
}); 

create app/config/production folder

create .gitignore file in it, content:

@MwirabuaTimothy
MwirabuaTimothy / DBCreate.php
Last active September 17, 2015 14:09
Artisan command for quickly creating a database.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class DBCreate extends Command
{
/**
* The name and signature of the console command.
@MwirabuaTimothy
MwirabuaTimothy / DBDrop.php
Last active September 17, 2015 14:08
Artisan command for quickly dropping a database.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class DBDrop extends Command
{
/**
* The name and signature of the console command.
@MwirabuaTimothy
MwirabuaTimothy / AppInstall.php
Last active September 17, 2015 13:57
Artisan command that combines dropping, creating, migrating and seeding database
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class AppInstall extends Command
{
/**
* The name and signature of the console command.
@MwirabuaTimothy
MwirabuaTimothy / Toastr.php
Created September 30, 2015 12:19
Toastr JS Middleware For Laravel 5
<?php
namespace App\Http\Middleware;
use Closure;
class Toastr
{
/**
* Handle an incoming request.
@MwirabuaTimothy
MwirabuaTimothy / toastr.blade.php
Created September 30, 2015 12:22
Laravel 5 Blade Partial template for displaying ToastrJS notifications - @include('partials.toastr')
@if(session('toastr'))
<link rel="stylesheet" href="{{ asset('/plugins/toastr/toastr.min.css') }}">
<script src="{{ asset('/plugins/toastr/toastr.min.js') }}" type="text/javascript"></script>
<style type="text/css" media="screen">
.toast-top-right {
top: 50px;
}
</style>
@MwirabuaTimothy
MwirabuaTimothy / helpers.php
Last active June 20, 2016 07:15
laravel helper functions
<?php
/**
* Return a success response
*
* @return Response
*/
function success($message, $redirectUrl, $record=null)
{
@MwirabuaTimothy
MwirabuaTimothy / AppDebug.php
Last active January 13, 2016 19:36
Laravel artisan command for switching between debug modes for your app. Usage `php artisan app:debug true` and `php artisan app:debug false`
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class AppDebug extends Command {
/**
* The console command name.
@MwirabuaTimothy
MwirabuaTimothy / AppURL.php
Created January 13, 2016 16:34
Laravel artisan command for switching the url for your app depending on the environment. Usage `php artisan app:url http://shopofficer.com` or `php artisan app:url http://localhost:7000`
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class AppURL extends Command {
/**
* The console command name.