Skip to content

Instantly share code, notes, and snippets.

Ujjwal Ojha ojhaujjwal

Block or report user

Report or block ojhaujjwal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ojhaujjwal
ojhaujjwal / log.log
Created Aug 29, 2014
Vagrant error log
View log.log
nic7="none"
nic8="none"
hidpointing="ps2mouse"
hidkeyboard="ps2kbd"
uart1="off"
uart2="off"
lpt1="off"
lpt2="off"
audio="none"
clipboard="disabled"
View laravel-di-gist1.php
<?php
namespace App\Http\Controllers;
use App\User;
use App\Repositories\UserRepository;
use App\Http\Controllers\Controller;
class UserController extends Controller
{
View laravel-di-gist2.php
<?php
$container->bind('My\Service', function($container) {
return new My\Service($container->make('My\AnotherService'));
});
View laravel-di-gist3.php
<?php
namespace App\Http\Controllers;
use App\User;
use App\Http\Controllers\Controller;
class MyController extends Controller
{
protected $myService;
View laravel-di-gist5.php
<?php
$container->singleton('Facebook\Facebook', function() {
return new \Facebook\Facebook([
'app_id' => config('services.facebook.app_id'),
'app_secret' => config('services.facebook.app_secret'),
'default_graph_version' => 'v2.10',
]);
});
View laravel-di-gist6.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class MyServiceProvider extends ServiceProvider
{
public function register()
{
View php-background-job-gist4.php
<?php
use Bernard\Driver\PredisDriver;
use Predis\Client;
$predis = new Client('tcp://localhost', array(
'prefix' => 'bernard:',
));
$driver = new PredisDriver($predis);
View php-background-job-gist8.php
<?php
$handlers = [
'SendForgotPasswordEmail' => App\Handler\SendForgotPasswordEmailHandler::class,
'SendImportantEmail' => App\Handler\SendImportantEmailHandler::class,
];
View php-background-job-gist1.php
<?php
use Bernard\Message\PlainMessage;
use Bernard\Producer;
use Bernard\QueueFactory\PersistentFactory;
use Bernard\Serializer;
use Symfony\Component\EventDispatcher\EventDispatcher;
//.. create $driver
$queueFactory = new PersistentFactory($driver, new Serializer());
View php-background-job-gist2.php
<?php
use Bernard\Router\SimpleRouter;
use Bernard\Consumer;
use Symfony\Component\EventDispatcher\EventDispatcher;
// .. create driver and a queuefactory
$router = new SimpleRouter();
$router->add('SendForgotPasswordEmail', function() {
//TODO: here's the logic to sending your email
You can’t perform that action at this time.