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 / 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 / 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 / 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 / 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 / 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 / defatult.vcl
Last active December 20, 2015 01:29
varnish Drupal 7 configuration
acl internal {
"127.0.0.0"/24;
}
backend web1 { .host = "192.168.1.1"; }
backend web2 { .host = "192.168.1.2"; }
director default_director round-robin {
{ .backend = web1; }
{ .backend = web2; }
# uninstall old version
yum remove ruby rubygems -y
# Install deps
yum install -y libyaml libyaml-devel openssl libxml2-devel bison libxslt-devel openssl-devel tcl tk libffi tcl-devel tk-devel libffi-devel make
# Download Ruby
cd /usr/local/src/
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
tar -xvzf ruby-1.9.3-p392.tar.gz
@dmouse
dmouse / oauth.settings.yml
Last active December 21, 2015 13:09
Drupal 8, OAuth module configuration file
enable_provider : 1
request_token_lifetime: 7200
login_path: 'user/login'
@dmouse
dmouse / OAuthSettingsForm.php
Last active December 21, 2015 13:09
Drupal 8, OAuth example settings form
<?php
/**
* @file
* Contains \Drupal\oauth\Form\OAuthSettingsForm.
*/
namespace Drupal\oauth\Form;
use Drupal\system\SystemConfigFormBase;
@dmouse
dmouse / aouth.routing.yml
Created August 22, 2013 18:43
Drupal 8, oauth sample routing
oauth_admin_form:
pattern: '/admin/config/services/oauth'
defaults:
_form: 'Drupal\oauth\Form\OAuthSettingsForm'
requirements:
_permission: 'administer oauth'