Skip to content

Instantly share code, notes, and snippets.

View xthiago's full-sized avatar

Thiago Rodrigues (xthiago) xthiago

View GitHub Profile
@charliepage88
charliepage88 / symfonyCSV.html.twig
Created February 16, 2013 20:23
Symfony 2 CSV Export
id, field1, field2, field3
{% for row in data %}
{{ row.id }},{{ row.field1 }},{{ row.field2 }},{{ row.field3 }}
{% endfor %}
@mCzolko
mCzolko / FA2Symfony2.md
Last active April 23, 2019 04:11
How to integrate Font Awesome to Symfony 2

Integration

It's easy to integrate Font Awesome into Symfony2 (Twitter Bootstrap, or even use it on its own).

Composer

Add those lines to composer.json

{
  "repositories": [
    {
      "type": "package",
@devdave
devdave / Doctrin2Search.php
Created June 21, 2011 23:40
Semi-dynamic Doctrine2 search function
<?php
function searchCriteria($criteria){
$cleanCritera = array();
foreach($criteria as $key => $value){
if( isset( $this->_class->fieldNames[$key] ) && !empty($value) ){
$cleanCritera[$key] = $value;
}
}
if(empty($cleanCritera)){
@celosauro
celosauro / .gitconfig
Last active February 27, 2020 15:50
.gitconfig file
[user]
name =
email =
# username =
[core]
editor = nano
#whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[web]
browser = google-chrome
@jcaraballo
jcaraballo / git-branch-between-different-repositories.md
Created March 6, 2012 01:05
How to fork a github repository in bitbucket

#Create bitbucket branch

##Create local branch

$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
  master
* sync
@hileon
hileon / gist:1311735
Created October 25, 2011 07:39 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Windows)

General

Ctrl+KB toggle side bar
Ctrl+Shift+P command prompt
Ctrl+` python console
Ctrl+N new file

Editing

@aldenw
aldenw / gist:a64c01ff9f18c660f114d2611fa6bb06
Last active May 23, 2023 19:48
Delete already merged remote branches
git branch -r --merged | egrep -v '(master|main|release|development)' | sed 's/origin\///' | xargs -n 1 git push --delete origin
@Ocramius
Ocramius / Rand.php
Created April 14, 2011 13:23
MySQL RAND() function in Doctrine2 DQL
<?php
namespace My\Custom\Doctrine2\Function;
/**
* RandFunction ::= "RAND" "(" ")"
*/
class Rand extends FunctionNode
{
public function parse(\Doctrine\ORM\Query\Parser $parser)
@chadrien
chadrien / README.md
Last active September 1, 2023 12:43
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
@beberlei
beberlei / Document.php
Created May 18, 2011 10:46
My Symfony2 File Upload workflow
<?php
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* @Entity
*/
class Document
{