Skip to content

Instantly share code, notes, and snippets.

View zerolab's full-sized avatar
🖖
Live long and prosper

Dan Braghiș zerolab

🖖
Live long and prosper
View GitHub Profile
@zerolab
zerolab / gist:9813838
Created March 27, 2014 17:53
Postgres: output results to CSV file
\f ','
\a
\t
\o /tmp/output.csv
SELECT column_id, column_name FROM TABLE_NAME;
\o
\q
@zerolab
zerolab / gist:9976471
Created April 4, 2014 15:01
date_api date transformations
<?php
$date = new DateObject($date_raw, date_get_timezone_db($field['settings']['tz_handling']));
$date_formatter = date_format($date, DATE_FORMAT_ISO);
<?php
/**
* @file Feeds mappers for Workbench Access.
*/
/**
* Implements hook_feeds_processor_targets_alter().
*/
function workbench_access_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name){
diff --git a/includes/database.mysqli.inc b/includes/database.mysqli.inc
index e208a66..e4eb6a5 100644
--- a/includes/database.mysqli.inc
+++ b/includes/database.mysqli.inc
@@ -133,34 +133,72 @@ function _db_query($query, $debug = 0, $slave = FALSE) {
$query = '/* '. $name .' : '. $bt[2]['function'] .' */ '. $query;
}
- $sent_to_slave = FALSE;
- if (isset($active_slave_db) && $slave) {
# Respond to incoming requests.
sub vcl_recv {
# ...code from above.
# Remove all cookies that Drupal doesn't need to know about. ANY remaining
# cookie will cause the request to pass-through to Apache. For the most part
# we always set the NO_CACHE cookie after any POST request, disabling the
# Varnish cache temporarily. The session cookie allows all authenticated users
# to pass through as long as they're logged in.
if (req.http.Cookie) {
diff --git a/views/timefield_handler_field_timefield.inc b/views/timefield_handler_field_timefield.inc
index a57e979..a82986a 100644
--- a/views/timefield_handler_field_timefield.inc
+++ b/views/timefield_handler_field_timefield.inc
@@ -9,29 +9,55 @@ class TimefieldHanlderFieldTimefield extends views_handler_field_field {
* Add additional tokens
*/
function add_self_tokens(&$tokens, $item) {
+ // If $item['raw'] is exist then we can use it
+ if (isset($item['raw'])) {
diff --git a/config.php b/config.php
index b4e26e4..2185e29 100644
--- a/config.php
+++ b/config.php
@@ -5,8 +5,8 @@
* @package MCManager.includes
*/
// General settings
- $config['general.engine'] = 'GoogleSpell';
- //$config['general.engine'] = 'PSpell';
if (typeof tinyMCE !== 'undefined') {
// see http://www.tinymce.com/forum/viewtopic.php?id=25977
var ed = tinyMCE.activeEditor;
ed.onNodeChange.add(function(ed, cm, n, co, o) {
n = ed.dom.getParent(n, 'span.media-element');
tinymce.each(ed.dom.select('span.media-element', o.node), function(n) {
// The criterias for choosing the span tags, that insert a br on pressing
// enter when the span.xml_include tag was the last one in a paragraph
if(!n.hasChildNodes() || (n.hasChildNodes() && n.firstChild.nodeName.toLowerCase() == "br" )) {
@zerolab
zerolab / db_clean.sh
Last active August 29, 2015 14:03
db_clean.sh
#!/bin/bash
#
# Remove INSERTs from tables you don't want in the database using a rather horrid grep hack.
# This probably assumes that the original mysqldump was performed with the --opt flag.
#
set -e
if [ -z "$1" ]; then
echo "You must specify an sql file"
@zerolab
zerolab / shib_auth.make
Last active August 29, 2015 14:05
shib_auth.make
api = 2
core = 7.x
projects[drupal][version] = 7.31
projects[shib_auth][type] = module
projects[shib_auth][download][url] = http://git.drupal.org/project/shib_auth.git
projects[shib_auth][download][type] = git
projects[shib_auth][download][revision] = 0b3b72cfd96eba2100359b006e7179b6bbe6c708
projects[shib_auth][patch][] = https://www.drupal.org/files/issues/disable-profiles-729388-15.patch