Skip to content

Instantly share code, notes, and snippets.

View damienalexandre's full-sized avatar
❤️
I̴͍͋ ̶͉͠Ḻ̸̅O̸͈̚V̷̨͒E̸̛ ̵̲̓Ü̷Ṅ̴̩I̴̳͑C̵͉͂O̷̹͗D̸̤̃È̴̪

Damien Alexandre damienalexandre

❤️
I̴͍͋ ̶͉͠Ḻ̸̅O̸͈̚V̷̨͒E̸̛ ̵̲̓Ü̷Ṅ̴̩I̴̳͑C̵͉͂O̷̹͗D̸̤̃È̴̪
View GitHub Profile
@damienalexandre
damienalexandre / ProfilerController.php
Created July 5, 2015 15:10
Adding a checkbox on the translation panel + custom save controller
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ProfilerController extends Controller
@damienalexandre
damienalexandre / tool.php
Created October 3, 2011 09:47
Download large file from the web via php
<?php
/**
* Download a large distant file to a local destination.
*
* This method is very memory efficient :-)
* The file can be huge, PHP doesn't load it in memory.
*
* /!\ Warning, the return value is always true, you must use === to test the response type too.
*
* @author dalexandre
@damienalexandre
damienalexandre / PrismCarpet.ino
Last active November 7, 2019 17:46
Arduino code making an HTTP request to Google Analytics and returning the status code. Replace `YOURGAID-HERE` by your GA tag.
#include <SPI.h>
#include <Ethernet.h>
// Thx http://bildr.org/2012/11/force-sensitive-resistor-arduino/
// Make use of https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide
// MAC Address, needed by the Ethernet Shield
byte mac[] = { 0xB0, 0xC0, 0xDE, 0xEF, 0xFE, 0xC7 };
int pin_red = 7; // Red LED
@damienalexandre
damienalexandre / src_Dalexandre_MyBundle_Pagerfanta_Adapter_DoctrineORMNativeQueryAdapter.php
Created August 23, 2011 08:29
This file is not part of the Pagerfanta package. We hack the Pagerfanta to allow Doctrine nativeQuery pagination.
<?php
/*
* This file is not part of the Pagerfanta package.
* We hack the Pagerfanta to allow Doctrine nativeQuery pagination.
*/
namespace Dalexandre\MyBundle\Pagerfanta\Adapter;
use Doctrine\ORM\QueryBuilder;
@damienalexandre
damienalexandre / arduino_read.py
Created August 12, 2013 16:16
Read serial from USB connected arduino, in python.
import serial
ser = serial.Serial('/dev/ttyUSB0', 9600)
while 1:
print ser.readline()
@damienalexandre
damienalexandre / DatabaseSchemaTest.php
Created October 9, 2015 10:17
Test doctrine schema automatically for missing / broken migrations.
<?php
namespace AppBundle\Tests;
use Doctrine\ORM\Tools\SchemaTool;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
/**
* Use Doctrine default entity manager and compare it's metadata to the actual database schema.
*
### Keybase proof
I hereby claim:
* I am damienalexandre on github.
* I am damienalexandre (https://keybase.io/damienalexandre) on keybase.
* I have a public key ASCu143W_WWJX8WQ0pNHfTsGiOywQiwcj9YtZHNOUBAzHAo
To claim this, I am signing this object:
text: Calendrier de l'Afsy, avec des Bundles indexés.
analyzer:
custom_french_analyzer:
type: custom
tokenizer: letter
filter: ["asciifolding", "lowercase", "french_stem", "stop_fr"]
filter:
stop_fr:
type: "stop"
@damienalexandre
damienalexandre / coucou.sh
Created October 25, 2013 14:55
How to use ElasticSearch / Basic facet query
curl -XDELETE 'http://localhost:9200/pony_index_tmp'
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d '
{
"number_of_shards": 1,
"number_of_replicas": 0
}'
curl -XPUT 'http://localhost:9200/pony_index_tmp/post/_mapping' -d '
curl -XDELETE 'http://localhost:9200/pony_index_tmp'
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d '
{
"number_of_shards": 1,
"number_of_replicas": 0
}'