Skip to content

Instantly share code, notes, and snippets.

View developerdino's full-sized avatar

Dean Tedesco developerdino

  • Verified International @verifedit
  • Melbourne, Australia
  • 20:29 (UTC +10:00)
  • X @developerdino
View GitHub Profile
for i in `seq 1 100`; do echo $(( ( RANDOM % 10 ) + 1 )); done
@developerdino
developerdino / DebugServiceProvider.php
Last active April 22, 2021 01:34
Laravel: Log all queries with bound parameters observer.
<?php
namespace App\Providers;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\ServiceProvider;
class DebugServiceProvider extends ServiceProvider

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@developerdino
developerdino / vim-command
Last active August 29, 2015 14:07
vim sudo save
:w !sudo tee %
@developerdino
developerdino / scomposer
Last active August 29, 2015 14:08 — forked from trq/scomposer
#!/usr/bin/env bash
d=$(date +%s)
remote='some-aws-box'
dir="composer-$d.tmp"
if [ -f composer.json ]; then
ssh $remote mkdir "$dir"
scp composer.json $remote:"$dir"/composer.json
@developerdino
developerdino / gist:0c2daaee070071ff5dcd
Created November 19, 2014 07:13
URL encoded tick %E2%9C%93
%E2%9C%93
find app -name '*.php' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
find boostrap -name '*.php' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
find config -name '*.php' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
find database -name '*.php' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
find public -name '*.php' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
find resources -name '*.php' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
find storage -name '*.php' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
find tests -name '*.php' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
@developerdino
developerdino / tabs-to-spaces.sh
Last active August 29, 2015 14:14
Convert tabs to spaces in all files
#!/usr/bin/env bash
find . -name '*.php' ! -type d -exec bash -c 'expand -t 4 "$0" |tee "$0" 2>&1 > /dev/null' {} \;
@developerdino
developerdino / Beanstalk_to_GitHub
Created September 23, 2015 01:59
Move Git Repository from Beanstalk to GitHub with full repository history
#Example moving the DPSG Global Library
# 1 Checkout the Beanstalk Repo
git clone --bare git@codeandtheory.beanstalkapp.com:/dpsg-global-library.git
# 2 Push into your desired GitHub repo. (Please note that you must create the github repo prior to this step)
git push --mirror git@github.com:codeandtheory/dpsg-global-library.git
@developerdino
developerdino / setup_xdebug.sh
Last active March 6, 2022 10:17
Setup XDebug on Laravel Homestead 4.0 with PHP 7.0
#!/usr/bin/env bash
wget http://xdebug.org/files/xdebug-2.4.0rc3.tgz
tar -xvzf xdebug-2.4.0rc3.tgz
cd xdebug-2.4.0RC3
phpize