Skip to content

Instantly share code, notes, and snippets.

View Davidmattei's full-sized avatar

David mattei Davidmattei

  • Sappico
  • Belgium
View GitHub Profile
@invalidusrname
invalidusrname / Vagrantfile
Last active April 3, 2019 20:58
Connecting between VMs with vagrant
config.vm.define :puppet do |app_config|
app_config.vm.customize ["modifyvm", :id, "--name", "puppet", "--memory", "512"]
app_config.vm.box = "precise_with_puppet"
app_config.hosts.name = 'puppet'
app_config.vm.host_name = 'puppet'
app_config.vm.forward_port 22, 2222, :auto => true
app_config.vm.forward_port 80, 4561
app_config.vm.network :hostonly, "33.13.13.01"
app_config.vm.provision :shell do |shell|
shell.path = "../puppet_master_setup.sh"
@danvbe
danvbe / 1-Explanations.md
Last active April 21, 2023 15:39
A way to integrate FosUserBundle and HWIOAuthBundle

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.
<VirtualHost *:80>
   DocumentRoot /mnt/project/web
   RewriteEngine On
   RewriteCond %{DOCUMENT_ROOT}/$1 !-f
   RewriteRule ^/direcory/(.*)$ /direcory/app_dev.php [QSA,L,PT]
   Alias /direcory /mnt/project/web
@samsamm777
samsamm777 / gist:7230159
Last active April 26, 2024 13:24
PHP set private property value using reflection. This allows you to set a private property value from outside the object, great for PHPUnit testing.
<?php
$a = new A();
$reflection = new \ReflectionClass($a);
$property = $reflection->getProperty('privateProperty');
$property->setAccessible(true);
$property->setValue($a, 'new-value');
echo $a->getPrivateProperty();
//outputs:
@nateevans
nateevans / MenuBuilder.php
Created April 3, 2014 16:56
KNP Menu Bundle with Bootstrap 3 and Font Awesome 4 (see http://bit.ly/1sd1rJr , thanks to Niels Mouthaan!)
<?php
namespace Acme\HelloBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class MenuBuilder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@lologhi
lologhi / 1.How to easily implement a REST API with oAuth2 presentation.md
Last active April 4, 2024 22:13
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

@floriankraft
floriankraft / JcrQueryLibrary.md
Last active May 3, 2024 05:50
Some useful JCR queries (XPATH, SQL2) for AEM/CQ development.

SQL2

All nodes with a specific name

SELECT * FROM [nt:unstructured] AS node
WHERE ISDESCENDANTNODE(node, "/search/in/path")
AND NAME() = "nodeName"

All pages below content path

@OlivierParent
OlivierParent / Symfony - RESTful API.md
Last active December 6, 2017 13:38
Symfony - RESTful API.md

NMDAD III — Symfony — RESTful API

New Media Design & Development III - The Symfony Framework Academiejaar 2014-2015, Arteveldehogeschool ©2014 Olivier Parent


[TOC]

@calebbrewer
calebbrewer / Stop SELinux from blocking apache external program execution.md
Last active October 10, 2019 09:29
Allow apache to execute an external program through SELinux.

Allow apache to execute an external program through SELinux

This is helpful when you don't want to disable SELinux but do want to allow apache to execute an external program. For example wkhtmltopdf. Run the following commands from the terminal. (This has been tested in CentOS 7.)

Allow Exicution

setsebool httpd_execmem on

Change a dirs security context if the program writes to a file

@calebbrewer
calebbrewer / wkhtmltopdf-install.md
Last active April 20, 2023 23:28
How to Setup wkhtmltopdf on CentOS 7

How to Setup wkhtmltopdf on CentOS 7

Install Dependencies

yum install fontconfig libXrender libXext xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi freetype libpng zlib libjpeg-turbo

Install wkhtmltopdf