Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexandre Salomé alexandresalome

View GitHub Profile
View .gitconfig
[alias]
st = status
ci = commit
br = branch
co = checkout
up = pull --rebase --autostash
ds = diff --staged
lg = log --oneline --graph --decorate
[core]
excludesfile = ~/.gitignore
View AppKernel.php
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';
View 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 / security-password-encoder.php
Created Jan 26, 2015
Demonstration of password encoder
View security-password-encoder.php
<?php
<<<CONFIG
packages:
- symfony/security
CONFIG;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
# $encoder = new MessageDigestPasswordEncoder();
View command.php
<?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';
View 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 Feb 5, 2014
PHP - Getters and Setters for SublimeText
View README
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 Sep 22, 2013
Reduce amount of logic in your templating: set business in your array definition, not in template body.
View gist:6658708
<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'),
},
{
You can’t perform that action at this time.