Skip to content

Instantly share code, notes, and snippets.

@mablae
mablae / noise.sh
Created October 10, 2011 13:34 — forked from rsvp/noise.sh
noise : relaxing ambient Brown noise generator (cf. white noise) | Linux bash script using sox | CogSci notes
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-10-04
#
# _______________| noise : ambient Brown noise generator (cf. white noise).
#
# Usage: noise [minutes=59] [band-pass freq center=1786] [wave]
# ^minutes can be any positive integer.
# Command "noise 1" will display peak-level meter.
#
# Dependencies: play (from sox package)
<?php
namespace Acme\DemoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Mablae\WirGehenMitBundle\Entity\Category
*
* @ORM\Table(name="feedbackcategory")

Adding variables to twig output

Yesterday @userfriendly posted a interesting Question on Freenode/#symofony:

He asked about how to add class attributes to the <option> Tags of a EntityType.php form field. After looking at the code we found out that this is not possible at all with the native behavior of the EntityType or with any <select> field.

Then I had the idea to work the variables I can access without making changes to the Symfony2 Modules. Here is the solution:

@mablae
mablae / dabblet.css
Created August 5, 2012 04:45
Untitled
h1 {
margin-top: 50px;
line-height: 45px;
position: relative;
display: block;
text-align: center;
}
@mablae
mablae / awesome-php.md
Last active December 15, 2015 00:09 — forked from ziadoz/awesome-php.md
Fix Url

Awesome PHP Libraries

A list of amazingly awesome PHP libraries that you should consider using (and some other shiny extras).

@mablae
mablae / gen-changelog.sh
Last active December 29, 2015 13:29
Creates a GIT Changelog based on Tags
#!/bin/bash
tags=()
for tag in $(git for-each-ref --sort='-refname:short' --format='%(refname:short)' refs/tags) ; do
tags+=($tag)
done
lastTag=0
totalTags=${#tags[*]}
# ========================================
# Testing n-gram analysis in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/ngram_test
curl -X PUT localhost:9200/ngram_test -d '
{
"settings" : {
"index" : {
"analysis" : {

We create an index with:

  • two filters: synonyms_expand and synonyms_contract
  • two analyzers: synonyms_expand and synonyms_contract
  • three text fields:
    • text_1 uses the synonyms_expand analyzer at index and search time
    • text_2 uses the synonyms_expand analyzer at index time, but the standard analyzer at search time
    • text_3 uses the synonyms_contract analyzer at index and search time

.

@mablae
mablae / gist:8cd3e5b0732c88b2a90a
Created January 26, 2016 02:07 — forked from fbrnc/gist:4550079
Make Behat/Mink create a screenshot when a test fails
<?php
class FeatureContext extends MinkContext {
/**
* Take screenshot when step fails.
* Works only with Selenium2Driver.
*
* @AfterStep
*/
@mablae
mablae / BlogPostHydrator.php
Last active July 19, 2016 15:03 — forked from Ocramius/BlogPostHydrator.php
Association lazy-loading with Zend\Db
<?php
use ProxyManager\Factory\LazyLoadingValueHolderFactory;
use Zend\Stdlib\Hydrator\HydratorInterface;
class BlogPostHydrator implements HydratorInterface
{
/**
* @var HydratorInterface
*/