Skip to content

Instantly share code, notes, and snippets.

@Filoz
Filoz / README.md
Created August 10, 2023 15:54 — forked from lsv/README.md
KNP Menu Bundle - Bootstrap 4 and Font Awesome 4
@Filoz
Filoz / Unattended Encrypted Incremental Backup to Amazon S3.md
Created October 14, 2016 14:48 — forked from janikvonrotz/Unattended Encrypted Incremental Backup to Amazon S3.md
Ubuntu: Unattended Encrypted Incremental Backup to Amazon S3#AmazonAWS#Markdown

Introduction

For this task we are going to configure a duplicity script wrapper. Unregarded of the installation instructions it's expected that you have already signed up for an Amazon account and know how to use their services.

Requirements

  • Ubuntu server
  • duplicity, Git, GnuPG
  • MySQL
@Filoz
Filoz / autoembed-example.php
Created July 18, 2016 23:37 — forked from joshhartman/autoembed-example.php
AutoEmbed PHP Class to parse a string for URLs on their own line and use oEmbed to embed remote content based on the URL
<!DOCTYPE html>
<html>
<head>
<title>AutoEmbed Examples</title>
</head>
<body>
<h1>AutoEmbed Examples</h1>
<?php
$content = "
<p>Have a laugh...</p>
<?php
namespace AppBundle\Form\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
class AddEntityChoiceSubscriber implements EventSubscriberInterface
@Filoz
Filoz / 1.How to easily implement a REST API with oAuth2 presentation.md 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. :

@Filoz
Filoz / FOSUBUserProvider.php
Created March 23, 2016 17:58 — forked from yahuarkuntur/FOSUBUserProvider.php
My Integration of FosUserBundle and HWIOAuthBundle (symfony 2.7 and hwi/oauth-bundle 0.3.9)
<?php
namespace AppBundle\Services;
use HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface;
use HWI\Bundle\OAuthBundle\Security\Core\User\FOSUBUserProvider as BaseClass;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* https://gist.github.com/danvbe/4476697
@Filoz
Filoz / 1-Explanations.md
Created March 23, 2016 17:58 — forked from danvbe/1-Explanations.md
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.
@Filoz
Filoz / HomeScreenController.java
Last active February 2, 2016 10:48
/com/bekwam/examples/javafx/dynamic/app_core/HomeScreenController.java
package com.bekwam.examples.javafx.dynamic.app_core;
import com.bekwam.examples.javafx.dynamic.annotations.SubApp;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;