Skip to content

Instantly share code, notes, and snippets.

View dmouse's full-sized avatar
🏠
Working from home

David Flores dmouse

🏠
Working from home
View GitHub Profile
@dmouse
dmouse / my.module
Last active December 19, 2015 22:49
Sample to option in drupal node_type_form
function hook_form_node_type_form_alter(&$form, $form_state) {
$form['workflow']['node_options']['#options']['sample'] = t('Sample');
$form['workflow']['node_options']['rotativa']['#description'] = t('Sample enable');
//$form['#validate'][] = 'rotativa_node_type_form_validate';
}
/* Validate if Sample is active*/
function my_node_type_valid($type) {
$options = variable_get("node_options_$type", array());
@dmouse
dmouse / virtualhost.conf
Created July 2, 2013 05:04
Nginx config fiel for Virtualhost Drupal
server {
listen 80;
server_name wawa.com www.wawa.com;
server_tokens off;
aio off;
directio off;
sendfile on;
@dmouse
dmouse / config.fish
Last active December 17, 2015 04:19
fish-shell config file
# File ~/.config/fish/config.fish
function _git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function fish_prompt
# Alias
alias grep="grep -n --color -T"
# Prompt
@dmouse
dmouse / default.conf
Last active December 16, 2015 18:39
Nginx + PHP-FPM + Drupal, sample configuration file for nginx and Drupal
server {
listen 80;
server_name site.com www.site.com ;
server_tokens off;
aio off;
directio off;
sendfile on;
@dmouse
dmouse / drupal_redis_settings.php
Last active December 16, 2015 12:08
Configuration Drupal 7 + Redis + Predis.
<?php
// ...
define('PREDIS_BASE_PATH', DRUPAL_ROOT . '/sites/all/libraries/predis/lib/');
$conf['redis_client_interface'] = 'Predis';
$conf['cache_backends'][] = 'sites/all/modules/redis/redis.autoload.inc';
@dmouse
dmouse / query-solr.php
Created April 5, 2013 00:57
Create nested joins in apache solr with solarium. - This sample run with apache solr 4.x. - The nested querys is defined by the key _query_:" ... _query_:\" ... _query_:\" ... \" \" "
<?php
use \Solarium\Client as Client;
$config = array(
'endpoint' => array(
'localhost' => array(
'host' => '127.0.0.1',
'port' => 8080,
'path' => '/solr4/',
@dmouse
dmouse / .bashrc
Created March 28, 2013 06:01
Bashrc + Drush + GIT Branches
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias dl='drush dl'
alias en='drush en'
alias dis='drush dis'
@dmouse
dmouse / index_dev.php
Created March 4, 2013 03:33
Ejemplo de uso de Silex
// web/index_dev.php
require_once __DIR__.'/../vendor/autoload.php';
//inicio de la aplicación
$app = new Silex\Application();
//Index
$app->match('/', function () {
{% extends "base.html.twig" %}
{% block aside %}
Aside
{% endblock %}
@dmouse
dmouse / content.html.twig
Created March 4, 2013 02:55
Ejemplo de un bloque en twig
{% extends "base.html.twig" %}
{% block content %}
contenido
{% endblock %}