Skip to content

Instantly share code, notes, and snippets.

View cafuego's full-sized avatar
😢

Peter Lieverdink cafuego

😢
View GitHub Profile
#!/bin/bash
# This has to be run from master
git checkout master
# Update our list of remotes
git fetch
# Prune stale local branches already removed from origin
git remote prune origin
# Remove local fully merged branches
@cafuego
cafuego / degithub
Last active August 29, 2015 13:57
Rewrite github generated HTML to Backdrop filtered HTML
#!/usr/bin/php
<?php
if ($_SERVER['argc'] == 2) {
$file = $_SERVER['argv'][1];
}
else {
$file = 'php://stdin';
}
$fp = fopen($file, 'r');
@cafuego
cafuego / gist:9677096
Last active August 29, 2015 13:57
uc_gst module
; @file uc_gst.info
name = UC GST
description = Add GST information to the checkout process.
core = 7.x
dependencies[] = uc_cart
<?php
/**
* @file uc_gst.module
* GST module for Ubercart
(function($) {
/**
* Keep an unmodified copy of the core search callback function.
*/
Drupal.ACDB.prototype.coreSearch = Drupal.ACDB.prototype.search;
/**
* Override the search callback.
*
@cafuego
cafuego / quicktabs persist
Created December 23, 2013 00:56
Re-open a quicktab after clicking a link under said tab (for a quicktabs view)
(function ($) {
Drupal.qtpersist = Drupal.qtpersist || {};
Drupal.behaviors.qtpersist = {
attach: function (context, settings) {
$.extend(true, Drupal.settings, settings);
$('.quicktabs-wrapper', context).once(function(){
Drupal.qtpersist.prepare(this);
});
<?php
/**
* Implements hook_date_views_extra_tables().
*/
function webform_date_views_extra_tables() {
return array('webform_submissions' => 'webform_submissions');
}
$('#element').replaceWith('<div id="element">Reloading...</div>');
$.ajax({
type: 'POST',
url: '/js/element-callback',
dataType: 'json',
success: function (data) {
if (data.element) {
// Push the result into the wrapper div.
$('#element').replaceWith('<div id="element">' + data.element + '</div>');
}
@cafuego
cafuego / gist:6418333
Created September 3, 2013 00:01
mess with Drupal 7 status messages
/**
* Implements hook_preprocess_status_messages().
*
* Remove the login warning message, anon users can only see the login form anyway.
*/
function intranet_preprocess_status_messages(&$vars) {
$messages = drupal_get_messages('error');
if (!empty($messages['error'])) {
$errors = $messages['error'];
foreach ($errors as $error) {
@cafuego
cafuego / my.cnf
Created May 5, 2013 23:43
my.cnf for the replication slave that does backup dumps
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
@cafuego
cafuego / drush-make-wc.patch
Created May 2, 2013 00:25
Allow drush_make to keep a working-copy of a project.
diff --git a/drush_make.orig/drush_make.download.inc b/drush_make/drush_make.download.inc
index 92c68f9..2bd0bb5 100644
--- a/drush_make.orig/drush_make.download.inc
+++ b/drush_make/drush_make.download.inc
@@ -345,6 +345,7 @@ function drush_make_download_post($name, $download, $download_location) {
function drush_make_download_git($name, $download, $download_location) {
$tmp_path = drush_make_tmp();
$wc = drush_get_option('working-copy');
+ $wc = (!empty($download['working-copy'])) ? $download['working-copy'] : $wc;