Skip to content

Instantly share code, notes, and snippets.

View jtraulle's full-sized avatar

Jean Traullé jtraulle

View GitHub Profile
@slywalker
slywalker / pagination.ctp
Created October 5, 2011 07:25
pagination element for CakePHP on twitter bootstrap
<?php
if (!isset($modules)) {
$modulus = 11;
}
if (!isset($model)) {
$models = ClassRegistry::keys();
$model = Inflector::camelize(current($models));
}
?>
<div class="pagination">
@docteurklein
docteurklein / extract.sh
Created December 2, 2011 16:43
extract non translated sentences in twig templates
find . -type f -name "*.html.twig" | xargs perl -pi -e "s/>([^\s<{>].*?)</>{{ '\1'|trans }}</g"
@real34
real34 / ActionsHelper.php
Created April 12, 2012 08:16
CakePHP2.x : Twitter bootstrap base for projects
<?php
/**
* Action Helper
* Allows to generate simple CRUD links for a given object and customize its rendering
* It only works for default baked urls
*
* Usage:
* <code>
* $this->Actions->setActionsOptions($order['Order']['id'], true);
* echo $this->Actions->view();
@cowlby
cowlby / form_div_layout.html.twig
Created October 17, 2011 18:25
Customizing form collections in Symfony2
{% block collection_widget %}
{% spaceless %}
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': block('collection_item_widget') }) %}
{% endif %}
<div class="collection" {{ block('widget_container_attributes') }}>
{{ form_errors(form) }}
<table>
<thead>
<tr>
@weaverryan
weaverryan / forms.html.twig
Created April 13, 2012 11:26
Some basic Twitter Bootstrap Symfony2 form customizations
{# for twitter bootstrap specifically #}
{% block field_row %}
{% spaceless %}
<div class="control-group {% if errors|length > 0 %}error{% endif %}">
{{ form_label(form, label|default(null)) }}
<div class="controls">
{{ form_widget(form) }}
{{ form_errors(form)}}
</div>
</div>
@VeryStrongFingers
VeryStrongFingers / php-phpdbg-proxy.sh
Last active June 29, 2020 06:53
PHPStorm - PHP-PHPDBG Interpreter proxy
#!/bin/bash
#### Dirty/Fake PHP Interpreter to trick PHPStorm into using PHPDBG for running tests with/without code coverage
## For Mac/Linux only, Window's ubuntu subsystem theoretically would work too
##
## JETBRAINS IMPLEMENTED THE FEATURE REQUEST. No need to use this script anymore.
##
##
## Related JetBrain's issues/feature requests
## https://youtrack.jetbrains.com/issue/WI-21414
@mrkpatchaa
mrkpatchaa / git-export-changes-between-two-commits.md
Last active September 29, 2020 03:51
[Git command to export only changed files between two commits] #git

Use case : Imagine we have just created a project with composer create-project awesone-project (currently V0.2). 2 weeks later, there is a new release (V0.3). How to update your project ? Since composer update only updates the project dependencies, it is not what we are looking for. Composer doesn't know about awesome-project since it's not in our composer.json.

After trying many git solutions, I've come to this :

git archive --output=changes.zip HEAD $(git diff --name-only SHA1 SHA2 --diff-filter=ACMRTUXB)

This command will check for changes between the two commits and ignore deleted files.

@robinvdvleuten
robinvdvleuten / lambda-helloWorld.php
Last active March 2, 2022 00:41
Invoke sample Lambda function through PHP
<?php
require_once __DIR__.'/vendor/autoload.php';
use Aws\Lambda\LambdaClient;
$client = LambdaClient::factory([
'version' => 'latest',
// The region where you have created your Lambda
'region' => 'eu-west-1',
@cowlby
cowlby / collection_widget.twig
Created October 17, 2011 23:32
Customizing form collections in Symfony2
{% block collection_widget %}
{% spaceless %}
<div class="collection">
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': block('collection_item_widget') }) %}
{% endif %}
<div {{ block('widget_container_attributes') }}>
{{ form_errors(form) }}
<ul>
{% for rows in form %}
@LauLaman
LauLaman / gpg.md
Last active March 7, 2023 14:42
Use GPG to sign commits using git & PHPStorm

1 - install GPG tools : https://gpgtools.org/

2 - Create new key for your github email

3 - Add key to git on your local machine: git config --global user.signingkey YOURKEY

4 - configure git to sign all commits: git config --global commit.gpgsign true

5 - add to the bottom of ~/.gnupg/gpg.conf: (create the file if it not exists)