Skip to content

Instantly share code, notes, and snippets.

Hannes Kirsman hkirsman

View GitHub Profile
View display_errors_all.php
error_reporting(E_ALL);
ini_set('display_errors', 1);
@hkirsman
hkirsman / js_for_loop.js
Last active Nov 23, 2015
Javascript for loop
View js_for_loop.js
for (var i = 0; i < cars.length; i++) {
text += cars[i] + "<br>";
}
@hkirsman
hkirsman / hook_wysiwyg_editor_settings_alter.php
Last active Jan 4, 2016
Alter default Drupal CKEditor.
View hook_wysiwyg_editor_settings_alter.php
<?php
/**
* Implements hook_wysiwyg_editor_settings_alter().
*/
function salva_wysiwyg_editor_settings_alter(&$settings, &$context) {
if ($context['profile']->editor == 'ckeditor') {
if (arg(0) == 'node') {
$nid = arg(1);
@hkirsman
hkirsman / rasterize.js
Last active Dec 30, 2015 — forked from FiloSottile/rasterize.js
Add 4x zoom.
View rasterize.js
var page = require('webpage').create(),
address, output, size;
if (phantom.args.length < 2 || phantom.args.length > 3) {
console.log('Usage: rasterize.js URL filename');
phantom.exit();
} else {
address = phantom.args[0];
output = phantom.args[1];
page.viewportSize = { width: 2000, height: 100 };
@hkirsman
hkirsman / add_css_class_to_first_block_in_region.php
Last active Dec 24, 2015
Find the first block in content region that is not messages block and add class first-content-block-in-region to it.
View add_css_class_to_first_block_in_region.php
<?php
function THEME_preprocess_page(&$vars) {
foreach ($variables['page']['content']['content']['content'] as $key => &$var) {
if (isset($var['#block']) && $key !== 'delta_blocks_messages') {
$var['#block']->css_class = 'first-content-block-in-region';
break;
}
}
}
@hkirsman
hkirsman / lte-ie-8.css
Last active Dec 24, 2015
Drupal lte-ie-8.css
View lte-ie-8.css
<?php
function THEME_preprocess_html(&$vars) {
drupal_add_css(drupal_get_path('theme', 'THEME') . '/css/lte-ie8.css', array(
'group' => 9999,
'weight' => 9999,
'browsers' => array(
'IE' => 'lte IE 8',
'!IE' => FALSE
),
@hkirsman
hkirsman / equalHeight.js
Created Jun 28, 2013
Equal height script
View equalHeight.js
jQuery.fn.equalHeight = function() {
var $el = $(this);
var colsHighest = 0;
$el.css('min-height', 0).each(function() {
var height = $(this).height();
if (height > colsHighest) {
colsHighest = height;
}
});
@hkirsman
hkirsman / disable-menuitems.php
Created Jun 28, 2012
Wordpress plugin to disable some menu items
View disable-menuitems.php
<?php
/**
* @package Disable_Menuitems
* @version 1.0
*/
/*
Plugin Name: Disable Menuitems
Plugin URI:
Description: Remove some admin menuitems
@hkirsman
hkirsman / mobtable.html
Created Jun 27, 2012
turn tables into mobile friendly
View mobtable.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>table</title>
<style type="text/css">
.odd { background-color: #808080; }
.generated_for_mobile { margin-bottom: 30px }
@hkirsman
hkirsman / functions.php
Created Jun 26, 2012
Wordpress WPML custom
View functions.php
<?php
function languages_list_custom() {
$languages = icl_get_languages('orderby=code');
$languages_count = count($languages);
if(!empty($languages) && $languages_count>1){
echo '<div id="lang_sel_list_custom"><ul>';
$i=1;
global $sitepress_settings;
$show_flags = $sitepress_settings['icl_lso_flags'];
You can’t perform that action at this time.