Skip to content

Instantly share code, notes, and snippets.

View Tom32i's full-sized avatar

Thomas Jarrand Tom32i

View GitHub Profile
@Tom32i
Tom32i / gist:4984807
Created February 19, 2013 10:44
Sublime Text 2 : Indent config for french keyboards.
[
{ "keys": ["super+)"], "command": "indent" },
{ "keys": ["super+("], "command": "unindent" }
]
@Tom32i
Tom32i / template.html.twig
Last active December 16, 2015 03:49
Twig : isoler un template lors de l'include.
{# template.html.twig #}
{% set title = 'Mon titre' %}
{% set username = 'Jane Doe' %}
<h1>{{ title }}</h1>
<p>{{ username }}</p>
{% include 'user.html.twig' with {title: username} only %}
@Tom32i
Tom32i / template.html.twig
Last active December 16, 2015 03:49
Twig: Utiliser le tag embed.
{# template.html.twig #}
<h1>Mon grand titre </h1>
{% embed "user.html.twig" %}
{% block titre %}
<h2>Mon titre</h2>
{% endblock %}
{% block bottom %}
@Tom32i
Tom32i / Queriable.js
Created August 12, 2013 09:55
Queriable plugin.
function Queriable (form, subset, queryKey, callback, labels)
{
if (form.length === 1 && subset.length === 1) {
this.labels = typeof(labels) != "undefined" ? labels : {};
this.statement = [];
this.form = form;
this.subset = subset;
@Tom32i
Tom32i / number.js
Created August 22, 2013 09:00
So is it a number or not? Make up your mind Javascript!
var a = parseFloat("");
alert(typeof(a)); // "Number";
alert(a); // "NaN" a.k.a. Not a Number;
@Tom32i
Tom32i / fields.html.twig
Last active March 6, 2018 18:23
A simple way of automatically render Add and Delete buttons to collections through form theming. You just need to implement the "addPrototype(form_id)" Javascript function. #Symfony2 #Form #Collection
{% extends "form_div_layout.html.twig" %}
{% block form_row %}
{% spaceless %}
<div>
{{ form_label(form) }}
{{ form_errors(form) }}
{{ form_widget(form) }}
@Tom32i
Tom32i / table.css
Created September 20, 2013 08:04
CSS Table Behaviors
.table-behaviors {
display: table /* <table> */
display: table-cell /* <td> */
display: table-row /* <tr> */
display: table-column /* <col> */
display: table-column-group /* <colgroup> */
display: table-footer-group /* <tfoot> */
display: table-header-group /* <thead> */
}
@Tom32i
Tom32i / ChoiceExtension.php
Last active December 29, 2015 17:59
Working with choice attributes.
<?php
namespace Acme\DemoBundle\Twig;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Doctrine\Common\Inflector\Inflector;
class ChoiceExtension extends \Twig_Extension
{
/**
@Tom32i
Tom32i / sortable.less
Created December 4, 2013 09:54
sortable
.table {
.sorted {
.asc:before,
.desc:before {
content: "";
margin-right: 5px;
.caret();
}
.asc:before {
border-top: 0;
@Tom32i
Tom32i / Key Bindings - User.json
Last active January 4, 2019 09:40
Sublime Text 3 Base configuration
[
{ "keys": ["super+)"], "command": "indent" },
{ "keys": ["super+("], "command": "unindent" }
]