Skip to content

Instantly share code, notes, and snippets.

View marekkalnik's full-sized avatar
😁

Marek Kalnik marekkalnik

😁
View GitHub Profile
@marekkalnik
marekkalnik / FormType.php
Created January 23, 2013 10:50
Symfony2 Forms: remove an inherited field
<?php
class AccountCreationType eextends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('partner_opt_in')
->remove('global_opt_in');
}
@marekkalnik
marekkalnik / NewsletterSubscription.php
Last active December 12, 2015 00:29
EventDispatcherAwareModelInterface hack
<?php
namespace Project\Bundle\Propel;
use Project\Bundle\Propel\om\BaseNewsletterSubscription;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class NewsletterSubscription extends BaseNewsletterSubscription implements \EventDispatcherAwareModelInterface
{
/**
@marekkalnik
marekkalnik / tree.html.twig
Created May 13, 2013 12:18
utilisation d'un macro pour une fonction récursive dans Twig
{% import _self as brandOrder %}
{% extends 'TheodoDemoBundle::base.html.twig' %}
{% macro brandOrder(brand) %}
<li class="nav level{{ brand.treeLevel }} more">
<div id="brand{{ brand.id }}"><span>{{ brand.title }}</span></div>
{% if brand.children|length > 0 %}
{% import _self as brandHelper %}
@marekkalnik
marekkalnik / partial_refs.php
Created May 17, 2013 08:46
Partial references with Doctrine
<?php
protected function getCart($clientCode, $salesmanCode)
{
$em = $this->getDoctrine()->getEntityManager();
$cart = $em->getRepository('TheodoExtranetBundle:ShoppingCart')
->findOneBy(array(
'customerCode' => $clientCode,
@marekkalnik
marekkalnik / watchr.rb
Created August 7, 2013 12:35
My watchr config for PHPUnit Execute by typing: $ watchr watchr.rb
watch ('.*\.php$') {|phpFile| run_php_unit(phpFile)}
def run_php_unit(modified_file)
system('clear')
if (system("phpunit -c phpunit.xml"))
system("notify-send 'All test passed'")
else
system("notify-send 'Test failed'")
end
end
@marekkalnik
marekkalnik / 0_reuse_code.js
Created April 17, 2014 13:35
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
@marekkalnik
marekkalnik / questionnaire.md
Last active August 29, 2015 14:02
Questionnaire Agile

Questionnaire d'agilité

Agilité technique Coef
Projet en prod ? 4
Retours utilisateurs ? 3
Aucune régression la semaine dernière ? 3
Modèle validé avec le PO ? 2
Intégration continue ? (Jenkins ou Travis VERT) 2
Code review sur chaque Merge Request ? 1
@marekkalnik
marekkalnik / SpinningContext.php
Created July 9, 2014 14:47
Using spinners in BehatContext
<?php
use Behat\MinkExtension\Context\MinkContext;
class BaseFeatureContext extends MinkContext
{
/**
* This function prevents Behat form failing a tests if the HTML is not loaded yet.
* Behat with Selenium often executes tests faster thant Selenium is able to retreive
* the HTML causing false negatives.
#!/usr/bin/env node
var fs = require('fs');
var configFile = './platforms/ios/cordova/build.xcconfig';
var disableBitcode = function() {
fs.appendFile(configFile, "\n" + 'ENABLE_BITCODE = NO', function(err) {
if (err) {
console.log(err);
while (bam.exists) {
implementIdeas() && bam.improve();
}