Skip to content

Instantly share code, notes, and snippets.

# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@chmielot
chmielot / regexcrop.regex
Created October 11, 2012 11:51
Crop text after 20 chars with regex
([^\s][\s\S]{0,20}(?!=[^\s]))([\s]|$)
@chmielot
chmielot / gist:1992240
Created March 7, 2012 09:41
js: document ready
$(document).ready(function() {
});
@chmielot
chmielot / Stack_trace_multiple_choice.txt
Created February 24, 2012 20:45
Stack trace of empty multiple entity choice
Stack Trace
in /home/chmielot/public_html/nordwind/vendor/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php at line 65
}
if (error_reporting() & $level && $this->level & $level) {
throw new \ErrorException(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line));
}
return false;
at ErrorHandler ->handle ('2', 'array_fill(): Number of elements must be positive', '/home/chmielot/public_html/nordwind/vendor/doctrine-dbal/lib/Doctrine/DBAL/SQLParserUtils.php', '127', array('query' => 'SELECT j0_.id AS id0, ... FROM job j0_ WHERE j0_.id IN (?)', 'params' => array(), 'types' => array('102'), 'isPositional' => true, 'arrayPositions' => array(false), 'bindIndex' => '0', 'name' => '0', 'type' => '102', 'paramPos' => array('928'), 'paramOffset' => '0', 'queryOffset' => '0', 'needle' => '0', 'needlePos' => '928', 'len' => '0'))
at array_fill ('0', '0', '2')
# add your user to www-data and vise versa
sudo usermod -a -G www-data myusername
sudo usermod -a -G myusername www-data
# override umask in ~/.bashrc and /etc/init.d/apache2
umask 002
#restart
@chmielot
chmielot / twig template again
Created June 15, 2011 14:45
Generated Markup for subform
{% extends "BUMToolboxBundle::layout.html.twig" %}
{% form_theme form _self %}
{# ============== Customizations to rendering ===================== #}
{% block field_label %}
{% spaceless %}
<label for="{{ id }}"{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>{{ label|trans }}
{#
{% if required %}
@chmielot
chmielot / edit.html.twig
Created June 15, 2011 11:12
Form theming
{% extends "BUMToolboxBundle::layout.html.twig" %}
{% form_theme form _self %}
{# ============== Customizations to rendering ===================== #}
{% block field_label %}
{% spaceless %}
<label for="{{ id }}"{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>{{ label|trans }}
{#
{% if required %}
@chmielot
chmielot / rendered form
Created June 14, 2011 15:12
Form prototype - rendered form
The loop renders:
<div id="participants">
<div id="manifest_participants_0">...</div>
<div id="manifest_participants_1">...</div>
</div>
(without prototype)
`form_widget(form.participants)` renders to:
<div id="participants">
<div id="manifest_participants">
@chmielot
chmielot / edit.html.twig
Created June 14, 2011 12:07
Form prototype
{% extends "BUMToolboxBundle::layout.html.twig" %}
{# ============== Template ===================== #}
{% block app_header %}
Manifest-Editor
{% endblock %}
{% block content %}
<form class="manifest-form" method="post" action="{{ app.request.requestUri }}">
@chmielot
chmielot / Controller_DefaultController.php
Created May 25, 2011 10:40
[Form] Boolean choice field not preselected
<?php
namespace BUM\TestBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use BUM\TestBundle\Form\FooType;