Skip to content

Instantly share code, notes, and snippets.

View xthiago's full-sized avatar

Thiago Rodrigues (xthiago) xthiago

View GitHub Profile
@xthiago
xthiago / .bashrc
Created April 23, 2014 11:21 — forked from git-cd/.bashrc
PS1='\[\033[0;37m\][\t]\[\033[0;32m\][\u]\[\033[31m\][\h]`git branch 2>/dev/null | grep \* | head -1 | sed "s/\* //g" | awk "{ print \"[ \"\\\$1 \" ]\" }"` \[\033[1;33m\]\w\a\[\033[0m\]\n\$ '
<?php
namespace My\Custom\Doctrine2\Function;
/**
* RandFunction ::= "RAND" "(" ")"
*/
class Rand extends FunctionNode
{
public function parse(\Doctrine\ORM\Query\Parser $parser)
<?php
class LayoutExtension extends \Twig_Extension
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'yolo';
@xthiago
xthiago / AppKernel.php
Last active August 29, 2015 14:13 — forked from merk/AppKernel.php
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
// ....
protected function getKernelParameters()
<?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)){
@xthiago
xthiago / nginx.conf
Created December 2, 2013 04:39 — forked from LouWii/nginx.conf
# Things needed to be adapted :
# server_name my-domain.com
#
# root /home/www
# The root of the Symfony "web" folder (with app.php and app_dev.php in it).
#
# fastcgi_pass unix:/var/run/php5-fpm.sock
# This sock can be elsewhere (/var/run/php5-fpm/php5-fpm.sock for example...)
#
# There are other things needed to be changed/fixed.
@xthiago
xthiago / README.md
Created December 8, 2013 13:35 — forked from oodavid/README.md

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'