Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
if [ $# -le 3 ]
then
echo "Usage: $0 cert-name path-to-cert-public-key path-to-cert-private-key path-to-cert-chain"
exit 1
fi
aws iam upload-server-certificate \
--server-certificate-name ${1} \
@balintbrews
balintbrews / drupal_display_only_relevant_features_group.php
Last active August 29, 2015 14:05
Drupal snippet: Display only the relevant feature group on the Features admin UI
<?php
function YOUR_MODULE_form_features_admin_form_alter(&$form, &$form_state, $form_id) {
$form['packages']['#access'] = FALSE;
unset($form['package_YOUR_FEATURES_GROUP']['#group']);
}
@balintbrews
balintbrews / php_codesniffer-setup-for-drupal.md
Last active August 29, 2015 14:04
Sniff for the better — let's write Drupal code that rocks!

Great developers write great code that is not only great, but also follows the coding standards of the framework/language they use. We are great developers!

Today I'm challenging you that from now on, you only push code that follows Drupal's coding standards. But instead of asking you to learn and remember all those boring rules, I suggest you a great tool. PHP_CodeSniffer for the rescue! It is a PHP script that detects violations of a defined coding standard in your code. Coder module for Drupal is kind enough to define those standards for us.

Setting it up is really simple. There are many ways to install and use PHP_CodeSniffer. I'm going to share my favorite approach, which, I believe, is the most simple and straightforward way.

  1. Install Composer:

     $ curl -sS https://getcomposer.org/installer | php
     $ mv composer.phar /usr/local/bin/composer`  
    
@balintbrews
balintbrews / views_content_types.php
Last active August 29, 2015 13:58
Snippet to see what content types are used by your views in your Drupal site. Create a file with this content, then execute it with `drush php-script`.
<?php
$rows = array();
foreach (views_get_enabled_views() as $view) {
if ($view->base_table == 'node') {
foreach ($view->display as $display) {
if (isset($display->display_options['filters']['type'])) {
$rows[] = array(
sprintf('%s (%s)', $view->human_name, $view->name),
$display->display_title,
@balintbrews
balintbrews / custom-module-to-feature.md
Last active December 17, 2015 12:19
Ever happened to you that you were working on a custom module and realized you wanted to turn it into a feature, so that you can export Features components into it?

How to turn your custom module into a feature?

Ever happened to you that you were working on a custom module and realized you wanted to turn it into a feature, so that you can export Features components into it? Fortunately, it's fairly simple!

  1. Add this line to yourmodule.info:
    features[features_api][] = api:1

  2. Create a file called yourmodule.features.inc.

  3. Add this line at the beginning of yourmodule.module:

@balintbrews
balintbrews / gist:5489170
Last active December 16, 2015 19:59 — forked from colbyr/gist:2155434
cd /usr/local/Library/Formula
git checkout 9e18876 tomcat.rb
brew install tomcat
git checkout HEAD
@balintbrews
balintbrews / views_minimal_ui.module
Last active December 16, 2015 19:09
Screenshot: http://i.balintk.com/98cb1d9e7092e055.png. Proof of concept for a Drupal module that provides a simplified user interface for editing a specific view. This way customers are able to make small adjustments without having to face the Views UI.
<?php
/**
* @file
* Provides a minimal UI for editing a specific view.
*/
/**
* Implements hook_menu().
*/
@balintbrews
balintbrews / basetool_api_request_example.php
Created October 4, 2012 08:30
Example BaseTool API request
<?php
$result = BaseToolAPIRequest::getInstance()
->setResource('Business')
->setEndpointURLPieces(array('sv', '16346'))
->setParameter('WithTree', 'true')
->setParameter('WithRecommended', 'true')
->execute();
@balintbrews
balintbrews / 233-ns_core.make.patch
Created May 11, 2012 13:58
[233] ns_core.make changes
diff --git a/ns_core.make b/ns_core.make
index 88bce62..a4dd93b 100644
--- a/ns_core.make
+++ b/ns_core.make
@@ -254,3 +254,6 @@ projects[menu_block][patch][] = http://drupal.org/files/issues/1050766.fixed-par
; http://drupal.org/node/1484352#comment-5816158
projects[flag][patch][] = http://drupal.org/files/1484352-2-flag_validator_blocks_contextual_filters.patch
+
+; http://drupal.org/node/1535802
diff --git a/handlers/views_handler_argument.inc b/handlers/views_handler_argument.inc
index 3850d0a..6e9646c 100644
--- a/handlers/views_handler_argument.inc
+++ b/handlers/views_handler_argument.inc
@@ -104,6 +104,9 @@ class views_handler_argument extends views_handler {
$this->options['summary_options'] = $options['style_options'];
}
+ if (!empty($options['default_argument_skip_url']) && !isset($options['argument_skip_url'])) {
+ $this->options['argument_skip_url'] = 1;