Skip to content

Instantly share code, notes, and snippets.

View COil's full-sized avatar
🎯
Focusing

Loïc Vernet COil

🎯
Focusing
View GitHub Profile
@COil
COil / gist:3860246
Created October 9, 2012 17:38
start() of Session.php
/**
* Starts the session storage.
*
* @api
*/
public function start()
{
if (true === $this->started) {
return;
}
@COil
COil / gist:5004469
Last active December 14, 2015 01:09
Twig C extension benchmark 1/2
<h3>Categories</h3>
<ul>
{% for rankLevel1, field in form.datas.Category.choices %}
{% include 'ThemesBundle:Search:_group_tree.html.twig' with {'form': form, 'widget': 'Category', 'rankLevel1': rankLevel1, 'level': 1, 'field': field } %}
{% endfor %}
</ul>
@COil
COil / gist:5004477
Last active December 14, 2015 01:09
Twig C extension benchmark 2/2
<li>
{% if field.is_selected is defined %}
<input type="checkbox" value="1"{{ html_checked(selected) }} name="{{ name }}" id="{{ id }}" class="{{ class }}">
<label for="{{ id }}">{{ field.element }}</label>
{% endif %}
{% if field.choices is defined %}
<ul>
{% for rankLevel2, subField in field.choices %}
{% include 'ThemesBundle:Search:_group_tree.html.twig' with {
@COil
COil / es.sh
Last active August 29, 2015 14:03
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.2.1.deb
sudo dpkg -i elasticsearch-1.2.1.deb
@COil
COil / gist:79a284e101b5d78e761e
Last active August 29, 2015 14:06
Inline docblock in a foreach statement
<?php
// ...
$awardCount = count($this->finder);
foreach ($this->finder as $file /** @var $file \SplFileInfo */) {
try {
/**
* Load all ressources needed for the current website.
*
* @param LoaderInterface $loader
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
// Load generic configuration
$loader->load(__DIR__.'/config/config.yml');
@COil
COil / AppController.php
Last active March 5, 2017 23:47
Request class functions
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class AppController extends Controller
{
/**
* @Route("/my-route", name="blog_test")
@COil
COil / AppController.txt
Created February 28, 2017 13:49
AppController.php (output dump)
AppController.php on line 68:
array:33 [▼
"get('foo')" => "bar"
"hasPreviousSession" => true
"hasSession" => true
"getClientIps" => array:1 [▼
0 => "127.0.0.1"
]
"getClientIp" => "127.0.0.1"
"getScriptName" => "/app_dev.php"
@COil
COil / services.yml
Created October 16, 2017 14:12
Redis full DNS with database and port example + SNC bundle basic config
# @see https://github.com/snc/SncRedisBundle/blob/master/Resources/doc/index.md
parameters:
app_version: 6.0.0
# Redis
snc_redis.dsn: redis://%redis_node_1%:%redis_port%/%redis_database%
# https://github.com/snc/SncRedisBundle/blob/master/Resources/doc/index.md
snc_redis:
clients:
easy_admin:
design:
menu:
label: System
icon: 'server'
children:
- { label: 'PHP Info', route: easyadmin_phpinfo, icon: 'info' }