Skip to content

Instantly share code, notes, and snippets.

View paullinney's full-sized avatar

Paul Linney paullinney

View GitHub Profile
@paullinney
paullinney / auth-update.php
Created July 13, 2016 08:49
Acquia Auth to Selenium Client for Update (post) then returns status
/**
* Adds auth to update request (post)
*
* @param $update
*
* @return $update
*/
function update($update) {
$request = $this->client->createRequest($update);
$endpoint = $this->client->getEndpoint();
@paullinney
paullinney / auth-query.php
Created July 13, 2016 08:30
Acquia Auth to Selenium Client for Query (get) then returns result set
/**
* Adds auth to query request (get)
*
* @param $query
*
* @return $resultSet
*/
function query($query) {
$request = $this->client->createRequest($query);
$endpoint = $this->client->getEndpoint();
@paullinney
paullinney / auth.php
Last active July 13, 2016 08:29
Acquia Auth to Selenium Client for Update (post)
/**
* Update a Solarium client object for an 'Update' query
* with acquia authentication
*
* Needs to add following to, Solarium\Plugin\BufferedAdd\BufferedAdd.php:flush()
* after addDocuments call, so all flush queries get auth cookies:
*
* $sdsSolrBase = new SolrBase();
* $this->client = $sdsSolrBase->clientAttachAuth($this->client, $this->updateQuery);
*
# .platform/services.yaml
marketplace-database:
type: mysql:5.5
disk: 2048
marketplace-search:
type: solr:4.10
disk: 2048
marketplace-redis:
type: redis:2.8
git branch --merged master | grep -v master | xargs git branch -d
ps -e -orss=,args= | sort -b -k1,1n
/*
* Facets Widgets
**/
function HOOK_facetapi_facet_info() {
$facets = array();
$facets['ss_company_facet'] = array(
'field' => 'ss_company',
'label' => t('Company'),
function __the_end(){
if(($err=error_get_last()))
die('<pre>'.print_r($err,true).'</pre>');
}
register_shutdown_function('__the_end');
@paullinney
paullinney / gist:fb638dbb84149cbe0a0e
Created December 15, 2015 12:19 — forked from fabriceleal/gist:7803969
Decent enough macro for exporting csvs from Excel.
' http://support.microsoft.com/kb/291296/en-us
' http://superuser.com/questions/130592/how-do-you-force-excel-to-quote-all-columns-of-a-csv-file
' - change integer to long indexing
' http://stackoverflow.com/questions/2524703/save-text-file-utf-8-encoded-with-vba
' - output utf8 content
Sub QuoteCommaExport()
' Dimension all variables.
Dim DestFile As String
Dim FileNum As Integer
@paullinney
paullinney / mymodule.insall.php
Last active September 4, 2015 08:36
change text field length when data is present
/*
* Utility to change the max length of a text field
* @see http://nathan.rambeck.org/blog/42-modify-drupal-7-text-field-maximum-length
*
* @param string the field name to update
* @param integer the new field length
*/
function mymodul_change_text_field_max_length($field_name, $new_length) {
$field_table = 'field_data_' . $field_name;
$field_revision_table = 'field_revision_' . $field_name;