Skip to content

Instantly share code, notes, and snippets.

Carlton carltondickson

Block or report user

Report or block carltondickson

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
View gist:1616ad52717ad93790e1550a845d30ad
@carltondickson
carltondickson / TestSession.php
Created Jun 6, 2018
Laravel - Jobs - Sessions
View TestSession.php
<?php
# Dispatch the following job from multiple tinker instances will see session never gets updated.
# Using sessions in jobs is bad idea.
# $job = new \App\Jobs\TestSession(1, false);Bus::dispatch($job);
# $job = new \App\Jobs\TestSession(2, false);Bus::dispatch($job);
# @see https://github.com/laravel/framework/issues/20908
namespace App\Jobs;
View gist:ad979cc684027b64c0ff95383ae1c18c
// Create mailable, e.g. MailableTest
php artisan make:mail MailableTest --markdown=emails.mailable-test
// Run horizon or queue worker
// Open tinker
$mailable = (new \App\Mail\MailableTest())->onQueue('queue-name');
Mail::to('somemail@example.com')->send($mailable);
View gist:0bff7a425c4b1d0fa6d64c1abf04c91a
# /usr/bin/xdebug
#!/bin/bash
XDEBUG_CONFIG="idekey=xdebug" php -dxdebug.remote_host=`echo $SSH_CLIENT | cut -d "=" -f 2 | awk '{print $1}'` "$@"
@carltondickson
carltondickson / cache.md
Created Feb 28, 2017
Laravel 5.2 cache notes
View cache.md

Cache file name

  • Just an md5 of the cache key
  • Therefore not possible to identify key name from file name - md5 is one way

Cache directory name

  • Level 1 - First 2 characters of filename
  • Level 2 - Next 2 characters of filename
@carltondickson
carltondickson / gist:62977cee8ea32c6ce594eaa60524292b
Created May 17, 2016
Install and Configure Redis on Ubuntu 16.04
View gist:62977cee8ea32c6ce594eaa60524292b
# From https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04
# Use at your own risk
sudo apt-get update
sudo apt-get install build-essential tcl
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
cd redis-stable
@carltondickson
carltondickson / gist:2c6d2974780c0438ec8d
Created Feb 22, 2016
GIT - Reset to a previous commit
View gist:2c6d2974780c0438ec8d
# Local reset:
git reset --hard fj5789sufj
# Remote reset:
git push -f origin fj5789sufj:master
View gist:6f2560b1d14ef00084b1
# Checkout a tag
git checkout tags/0.0.3
# Checkout a branch
git checkout 0.0.3
View gist:52d0d1c5da8067f2e6ad
# Use http://xdebug.org/wizard.php to generate similar instructions to below for your setup based on your phpinfo() output
cd /tmp
wget http://xdebug.org/files/xdebug-2.4.0rc3.tgz
tar -xvzf xdebug-2.4.0rc3.tgz
cd xdebug-2.4.0RC3
phpize
./configure
make
sudo cp modules/xdebug.so /usr/local/php70/lib/php/extensions/no-debug-non-zts-20151012
sudo nano /etc/php7/php.ini
View gist:3d3c978faba5becf838b
# Ubuntu 14
sudo nano /etc/rc.local
mount -t vboxsf share_name_in_virtual_box /var/www/project
You can’t perform that action at this time.