Skip to content

Instantly share code, notes, and snippets.

@steffenr
steffenr / test.json
Last active August 29, 2015 13:58
GeoJSON Test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@steffenr
steffenr / gist:11401484
Created April 29, 2014 14:09
Programmatically create file-download link (file_entity / Drupal)>
<?php
// Get download uri of actual file.
$uri = file_entity_download_uri($file);
// We need query-params for download-token here.
$dl_link = l(t('Download'), $uri['path'], array('query' => $uri['options']['query']));
print $dl_link;
@steffenr
steffenr / leaflet_markercluster.drupal.js
Created January 27, 2015 18:29
Fix not working leaflet markercluster spidering in drupal - overwrite leaflet_markercluster via hook_js_alter in custom module
/*
* We are overriding a large part of the JS defined in leaflet (leaflet.drupal.js).
* Not nice, but we can't do otherwise without refactoring code in Leaflet.
*/
(function ($) {
var LEAFLET_MARKERCLUSTER_EXCLUDE_FROM_CLUSTER = 0x01;
Drupal.behaviors.leaflet = { // overrides same behavior in leaflet/leaflet.drupal.js
@steffenr
steffenr / gist:847064
Created February 28, 2011 08:11
theme date 'all' label drupal
<?php
function mytheme_date_all_day_label() {
return '';
}
?>
<?php
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => 'mypassword',
'database' => 'mydatabase',
'encoding' => 'utf8'
<?php
$db = ConnectionManager::getDataSource("mydatabase_extern");
$sql_extern = "SELECT id, name FROM table_extern";
$result = $db->query($sql_extern);
?>
<?php
$header_data = array(
array(
'header_background' => 'background-image:url(../img/header/header_sun12.jpg)',
'header_elements' => array(
array(
'img_link' => "link1.php",
'img_title' => "Link Titel",
'img_pos_left' => 240,
'img_pos_top' => 10,
<?php
$smarty->assign('rh',$header_data);
?>
@steffenr
steffenr / gist:847061
Created February 28, 2011 08:09
cakephp, booster
<?php
include('booster/booster_inc.php');
$booster = new Booster();
$booster->css_source = array(
'../css/smoothness/jquery-ui-1.8.5.custom.css',
'../css/jquery.fcbkcomplete.css',
'../css/formalize/formalize.css',
);
$booster->js_source = array(
'../js/lib/jquery-1.4.4.min.js',
<?php
$this->Model->setDataSource("db_extern"); // wechseln der Datenbankverbindung
$this->Model->findAll(...);
$this->Model->setDataSource("default"); // zurückwechseln zur "normalen" Verbindung
?>