Skip to content

Instantly share code, notes, and snippets.

View developerdino's full-sized avatar

Dean Tedesco developerdino

  • Verified International @verifedit
  • Melbourne, Australia
  • 07:56 (UTC +10:00)
  • X @developerdino
View GitHub Profile
for i in `seq 1 100`; do echo $(( ( RANDOM % 10 ) + 1 )); done

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 / parent-categories.sql
Created April 18, 2016 23:37
Get all parent records for a child category - is good for getting the records for a breadcrumb trail. Thanks to http://stackoverflow.com/questions/2441821/getting-all-parent-rows-in-one-sql-query
select t2.id, t2.name
from (
select
@r as _id,
(select @r := parent_id from categories where id = _id) as parent_id,
@l := @l + 1 as lvl
from
(select @r := :id, @l := 0) vars,
categories h
where @r <> 0) t1
# Commands for setting time on servers
# FOR TESTING PURPOSES ONLY #
# Disable NTP syncing
sudo timedatectl set-ntp 0
# Set time to when you want
sudo timedatectl set-time "2016-07-01 08:00:00"
# Enable NTP syncing