Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Helper function to retrieve all members of an organic group.
*/
function _get_users_in_group($gid) {
$group_members = array();
if (!empty($gid)) {
$query = db_select('users', 'u');
$query
->condition('u.uid', 0, '<>')
@steffenr
steffenr / gist:5402411
Created April 17, 2013 07:25
Using gource to visualize your version control.
gource --seconds-per-day 3 -1280x720 -o - | ffmpeg -y -r 30 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 gource.mp4
<VirtualHost *:80>
DocumentRoot "/Users/steffen/Sites/test/
ServerName local.test
ServerAlias local.test
Options Indexes FollowSymLinks MultiViews
</VirtualHost>
// Check all other checkboxes with same name also.
var elem_name = e.currentTarget.name;
var filter_check = $('input[name="'+elem_name+'"]');
filter_check.attr("checked", this.checked);
// Use uniform's update function.
$.uniform.update(filter_check);
@steffenr
steffenr / gist:5216005
Created March 21, 2013 19:35
search_api_override_server_settings
<?php
// Overriding search api server settings with help of the
// searchapi_server_settings.module.
$conf['search_api_override_server_settings'] = array(
'smb_solr_server' => array(
'host' => 'localhost',
'port' => '8983',
'path' => '/solr',
'http_user' => '',
'http_pass' => '',
@steffenr
steffenr / my.cnf
Created March 21, 2013 07:38
my.cnf working with large Drupal databases
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 64M
table_open_cache = 256
table_cache = 4096
sort_buffer_size = 64M
@steffenr
steffenr / qtip.js
Created February 26, 2013 10:31
Example Configuration for qtip - including custom class on qtip element.
// Example Configuration for qtip - including custom class on qtip element.
// Configure qTip.
$('.qtip-elem').each(function(){
$(this).children('.qtip-ico').qtip({
content: {
text: $(this).children('.qtip-cont').html()
},
show: 'mouseover',
hide: 'mouseout',
@steffenr
steffenr / book-all-books-block.html.twig
Last active October 14, 2021 05:30
Sample used in our second blog post on theming with Twig in Drupal 8
{% for book_id, menu in book_menus %}
<nav id="book-block-menu-{{ book_id }}" class="book-block-menu">
{{ menu }}
</nav>
{% endfor %}
@steffenr
steffenr / gist:4943967
Last active December 13, 2015 16:58
Domain Access - imagestyles per Domain
<?php
/**
* Helper function to get current machine_name of domain.
* - used in preprocess functions for setting corresponding image-styles for fields
* @return string
* machine_name of current domain
*/
function my_module_get_domain_machine_name() {
$machine_name = '';
// Get machine_name for actual domain.
@steffenr
steffenr / localize_datepicker.js
Last active October 10, 2015 19:48
localize jqueryUI datepicker to german
if($('input.datepicker').length) {
$('.datepicker').datepicker({
dateFormat: 'dd.mm.yy',
monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag','Samstag'],
dayNamesMin: ['So', 'Mo', 'Die', 'Mi', 'Do', 'Fre', 'Sa']
});
}