Skip to content

Instantly share code, notes, and snippets.

View sanguis's full-sized avatar
👁️‍🗨️
DevOpsing all the things

Josh Beauregard sanguis

👁️‍🗨️
DevOpsing all the things
View GitHub Profile
$(document).ready(function() {
$('#register-product-form > input[name="nid"][value="324"]').ready(function() {
$("#register-product-form > .register").children(":not(.slider)").remove();
$("#register-product-form > .submit-button").remove();
});
});
<?php
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'node')
->fieldCondition('field_campaign_filename', 'value', $value '=')
$result = $query->execute();
?>
@sanguis
sanguis / gist:4259600
Created December 11, 2012 15:57
views_query_alter() snippet date range
if (!empty($fields['min']['date']) || !empty($fields['max']['date'])) {
//date logic
if(!empty($fields['min']['date'])){
$min = new DateTime();
$mindate = explode("/", $fields['min']['date']);
$min->setDate($mindate[0],$mindate[1],$mindate[2]);
$min->setTime(00, 00, 00);
}
else {
$min = new DateTime('19900101');
@sanguis
sanguis / gist:4126095
Created November 21, 2012 17:07
a very intersting use of terninary operators
<?php
'#default_value' => empty($form_state['values']['ajax_example_2']) ?
$node->ajax_example['example_2'] :
$form_state['values']['ajax_example_2'],
@sanguis
sanguis / config.conf
Created September 14, 2012 14:15
drupal nginx config file for ubuntu 12.04 server
server {
server_name DOMAIN;
root /var/www/PATH;
index index.html index.htm index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
@sanguis
sanguis / gist:3042311
Created July 3, 2012 19:36
drupul compound hook_field_is_empty() function
<?php
/**
* Implements hook_field_is_empty().
*/
function FOO_contact_field_is_empty($item, $field) {
unset($item['_weight']);
$null = array_filter($item, 'isempty');
return empty($null);
}
@sanguis
sanguis / gist:2898467
Created June 8, 2012 22:33
em vars for a 13px basefont
@6: 0.353em;
@7: 0.412em;
@8: 0.471em;
@9: 0.529em;
@10: 0.588em;
@11: 0.647em;
@12: 0.706em;
@13: 0.765em;
@14: 0.824em;
@15: 0.882em;
@sanguis
sanguis / gist:2845349
Created May 31, 2012 18:47
scss config
#
# This file is only needed for Compass/Sass integration. If you are not using
# Compass, you may safely ignore or delete this file.
#
# If you'd like to learn more about Sass and Compass, see the sass/README.txt
# file for more information.
#
# Change this to :production when ready to deploy the CSS to the live server.
@sanguis
sanguis / gist:2764624
Created May 21, 2012 20:55
tidy settings that I found work best for feeds_xpathparser
<?php
$tidyConfig = array(
'merge-divs' => FALSE,
'merge-spans' => FALSE,
'join-styles' => FALSE,
'drop-empty-paras' => TRUE,
'wrap' => 0,
'tidy-mark' => FALSE,
'escape-cdata' => TRUE,
'word-2000' => TRUE,
@sanguis
sanguis / gist:2493155
Created April 25, 2012 20:37
search term and count
<?php
function search_tc_menu_alter(&$items) {
$items['search']['title callback'] = 'search_tc_title';
}
function search_tc_title($title) {
global $pager_total_items;
if ($pager_total_items[0] > 0) {
return t('!count search results for &#8220;!term&#8221;', array('!count' => $pager_total_items[0], '!term' => SEARCH_TERM));