Skip to content

Instantly share code, notes, and snippets.

@baptistedonaux
baptistedonaux / README.md
Created January 6, 2017 13:27 — forked from ruario/README.md
Installs (or updates) PPAPI Flash, so that it can be used by Chromium-based browsers

Usage

If you use Ubuntu or a derivative distro, issue the following to install an appropriate version of Flash:

sudo add-apt-repository "deb http://archive.canonical.com/ubuntu `lsb_release -cs` partner" 
sudo apt update
sudo apt install adobe-flashplugin

If your distro does not provide a copy of Pepper Flash that works with Vivaldi, this script will download and install it for you. To use, click on the "Download ZIP" button listed on the GitHub Gist page and then unpack the .zip archive locally. You should now have a directory containing the file "latest-pepper-flash.sh".

@baptistedonaux
baptistedonaux / rss.go
Last active February 26, 2020 11:01
Extract RSS in Golang
package main
import (
"encoding/xml"
"io/ioutil"
"log"
"os"
)
type Item struct {
@baptistedonaux
baptistedonaux / DeletedFilter.php
Created February 19, 2015 11:32
Soft Delete Symfony/Doctrine
<?php
namespace Namespace\MyBundle\Repository\Filters;
use Doctrine\ORM\Mapping\ClassMetaData;
use Doctrine\ORM\Query\Filter\SQLFilter;
class DeletedFilter extends SQLFilter
{
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
{
@baptistedonaux
baptistedonaux / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@baptistedonaux
baptistedonaux / UserProvider.php
Created August 20, 2014 15:25
UserProvider.php
<?php
namespace Namespace\MyBundle\Security\User;
use Doctrine\ORM\EntityManager;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Expr\Comparison;
use Symfony\Component\Security\Core\Exception\DisabledException;
use Symfony\Component\Security\Core\Exception\LockedException;
@baptistedonaux
baptistedonaux / SecurityController.php
Last active August 29, 2015 14:05
SecurityController for Symfony2 Framework
<?php
use JMS\SecurityExtraBundle\Annotation\Secure;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
@baptistedonaux
baptistedonaux / del_invisible_ascii_chars.php
Created June 4, 2014 09:54
Delete invisible ASCII chars which can generate errors.
<?php
gc_disable();
$content = file_get_contents("db.csv");
if ($content === false) {
echo "ERROR: impossible to read the file.";
die();
}
@baptistedonaux
baptistedonaux / auto_encode.php
Last active August 29, 2015 13:56
Auto detect encod string and return the same string to UTF-8 encode.
<?php
mb_convert_encoding($string, "UTF-8", mb_detect_encoding($string));
?>
@baptistedonaux
baptistedonaux / config.yml
Last active January 1, 2016 23:29
Comment déporter la session sous Symfony2.
# config.yml
framework:
# …
session:
# La session sera déportée dans app/var/sessions/
# N'oubliez pas de créer les deux dossiers, sinon Symfony2 n'arrivera pas à écrire dans votre répertoire
save_path: %kernel.root_dir%/var/sessions
# …