Skip to content

Instantly share code, notes, and snippets.

View alexandresalome's full-sized avatar

Alexandre Salomé alexandresalome

View GitHub Profile
@alexandresalome
alexandresalome / .gitconfig
Created November 28, 2019 15:37
Git configuration
[alias]
st = status
ci = commit
br = branch
co = checkout
up = pull --rebase --autostash
ds = diff --staged
lg = log --oneline --graph --decorate
[core]
excludesfile = ~/.gitignore
public function getCacheDir()
{
$dir = getenv('SYMFONY__CACHE_DIR') ?: dirname(__DIR__).'/var/cache';
return $dir.'/'.$this->getEnvironment();
}
public function getLogDir()
{
$dir = getenv('SYMFONY__LOGS_DIR') ?: dirname(__DIR__).'/var/logs';
@alexandresalome
alexandresalome / clipboard-editor
Created February 4, 2015 11:25
Edit your clipboard
#!/bin/bash
#
# Clipboard Editor - edit your clipboard in your favorite editor
set -e
# xclip command to execute
XCLIP_COMMAND="xclip -sel clipboard" # works on Xubuntu
# editor to use
@alexandresalome
alexandresalome / security-password-encoder.php
Created January 26, 2015 18:16
Demonstration of password encoder
<?php
<<<CONFIG
packages:
- symfony/security
CONFIG;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
# $encoder = new MessageDigestPasswordEncoder();
#!/bin/bash
gource -a 0.1 -s 1 -i 0
@alexandresalome
alexandresalome / command.php
Last active August 29, 2015 14:11
Command example
<?php
use Symfony\Component\Console\Application;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\EventDispatcher\EventDispatcher;
require_once __DIR__.'/vendor/autoload.php';
@alexandresalome
alexandresalome / clipboard-editor
Created December 7, 2014 21:43
clipboard-editor
#!/bin/bash
#
# Clipboard Editor - edit your clipboard in your favorite editor
set -e
# xclip command to execute
XCLIP_COMMAND="xclip -sel clipboard" # works on Xubuntu
# editor to use
@alexandresalome
alexandresalome / README
Created February 5, 2014 14:19
PHP - Getters and Setters for SublimeText
This SublimeText macro will generate your PHP getters and setters automatically.
Just create a list of attributes you want to generate getters and setters for:
class User
{
firstname
lastname
}
@alexandresalome
alexandresalome / gist:6658708
Created September 22, 2013 10:27
Reduce amount of logic in your templating: set business in your array definition, not in template body.
<ul class="nav navbar-nav">
{% set navbar_active = navbar_active|default(null) %}
{% set navbar_menu = navbar_menu|default([
{
'show': app.user and is_granted('ROLE_ADMIN'),
'active': navbar_active == 'design',
'label': 'Design',
'href': path('admin_design'),
},
{