Skip to content

Instantly share code, notes, and snippets.

aschiwi

Block or report user

Report or block aschiwi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aschiwi
aschiwi / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@aschiwi
aschiwi / gist:5856993
Created Jun 25, 2013
this goes in your theme's template.php
View gist:5856993
<?php
/**
* Override variables used in page.tpl.php.
*/
function YOURTHEMENAME_preprocess_page(&$vars) {
// Adds jquery accordion library so we can use it in our site.
drupal_add_library('system', 'ui.accordion');
}
@aschiwi
aschiwi / gist:5856988
Created Jun 25, 2013
Contents of your node
View gist:5856988
<div id="accordion">
<h3><a href="#titel1">Deine Überschrift</a></h3>
<div>Dein aufgeklappter Text</div>
<h3><a href="#titel2">Deine zweite Überschrift</a></h3>
<div>Dein aufgeklappter Text</div>
</div>
@aschiwi
aschiwi / accordion.js
Created Jun 25, 2013
Put this in your theme
View accordion.js
/**
* @file
* Use accordions in node body.
*/
(function ($) {
Drupal.behaviors.undpaulAccordion = {
attach: function(context) {
$('#accordion').accordion({
@aschiwi
aschiwi / update.sh
Last active Dec 18, 2015
Example update.sh
View update.sh
################################################################################
# Shell and drush commands to update the given installation
#
# Go to sites/all/scripts (e.g. cd sites/all/scripts) and type "sh update.sh"
# in your console/shell/Terminal.
#
# The commands have to be functional for any case after the initial installation
# installation. So on any set up after calling that script, the configuration
# must be the same.
#
@aschiwi
aschiwi / install.sh
Last active Nov 7, 2017
Example install.sh
View install.sh
################################################################################
# Shell and drush commands to set up (or some part of it) the new site.
#
# Go to sites/all/scripts (e.g. cd sites/all/scripts) and type "sh install.sh"
# in your console/shell/Terminal.
#
# The commands are built to run once, e.g. to set some symlinks, but shall be
# designed to not break other commands on the second run.
#
################################################################################
@aschiwi
aschiwi / gist:5848762
Created Jun 24, 2013
Example local.settings.php
View gist:5848762
<?php
// Database connection settings.
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'lokalerdatenbankname',
'username' => 'lokalerdatenbankbenutzer',
@aschiwi
aschiwi / gist:5848755
Created Jun 24, 2013
Include local.settings.php
View gist:5848755
<?php
/**
* Include local.settings.php
*
* The file is in .gitignore so we can safely use it for local configs.
*/
if (file_exists('sites/default/local.settings.php')) {
include('local.settings.php');
}
View gist:5780513
<?php
/**
* Implements hook__wysiwyg_editor_settings_alter().
*/
function MODULENAME_wysiwyg_editor_settings_alter(&$settings, $context) {
global $base_url;
if ($context['profile']->editor == 'ckeditor') {
$skins_path = drupal_get_path('module', 'MODULENAME') . '/ckeditor/skins';
@aschiwi
aschiwi / gist:5690860
Last active Dec 17, 2015
How to add classes and ids to main and secondary menu in Drupal 8. Add this to your theme's .theme file (in this case it's busy.theme). The .theme file is called template.php in Drupal 7.
View gist:5690860
/**
* Implements hook_preprocess_HOOK() for page.tpl.php
*/
function busy_preprocess_page(&$variables) {
// Pass the main menu and secondary menu to the template as render arrays.
if (!empty($variables['main_menu'])) {
$variables['main_menu']['#attributes']['id'] = 'main-menu';
$variables['main_menu']['#attributes']['class'] = array('links', 'clearfix');
}
if (!empty($variables['secondary_menu'])) {
You can’t perform that action at this time.