Skip to content

Instantly share code, notes, and snippets.

View allgood2386's full-sized avatar

Richard Allen allgood2386

  • Bixal
  • Northern Virgina
View GitHub Profile
@allgood2386
allgood2386 / ab test script
Last active December 14, 2015 19:18
figuring out ab testing
#!/bin/bash
# This script will run a series of ab benchmarks and print them out to a files directory in a drupal site with the -w
# flag for easy web browser reading.
# Example usage:
# ./thisScript.sh -u 'ourpassword:todev' -d http://somedomain.com -o dir/towrite/to -f 'index/ something.php /content/node/xxxx'
while getopts u:d:o:f: option
do
case "${option}"
in
<?php
/**
* Implements hook_node_view().
*/
function sponsor_school_page_node_view($node, $view_mode, $langcode) {
switch ($node) {
case $node->nid == '217308':
if(user_is_logged_in()) {
<?php
function taoti_javascript_menu() {
$items['slider/%/news-embed'] = array(
'page callback' => 'taoti_javascript_get_news_view_embed',
'delivery callback' => 'taoti_javascript_get_embed_wrapper',
'page arguments' => array(1),
'access callback' => TRUE,
);
$items['slider/%/topic-embed'] = array(
(function ($) {
Drupal.behaviors.taoti_javascript = {
attach: function (context, settings) {
$('.view-display-id-our_work_slider .views-field-nothing p').click( function () {
var tid = $(this).attr('data-tid');
var descURL = 'slider/' + tid + '/topic-embed';
var newsURL = 'slider/' + tid + '/news-embed';
$('#our-work-taxonomy-desc').empty();
<?php
/**
* Created by JetBrains PhpStorm.
* User: richallen
* Date: 9/25/13
* Time: 11:26 AM
* To change this template use File | Settings | File Templates.
*/
$tidList = array();
<?php
function custom_blocks_block_info() {
$blocks['left_social'] = array(
// info: The name of the block.
'info' => t('Social Header Left'),
);
/* Slider */
.jcarousel-skin-cssrc .jcarousel-clip-horizontal { background: #4F0F0F; }
/* Link */
.html a, ul.primary li.active a, .event-date-styled { color: #4F0F0F; }
.html a:visited, ul.primary li a:visited { color: #4F0F0F; }
.html a:hover, ul.primary li a:hover { color: #861919; }
function sponsor_school_page_menu() {
$items['add/teacher/%'] = array(
'title' => t('Add a Teacher'),
'page callback' => 'drupal_get_form',
'page arguments' => array('sponsor_school_page_add_teacher_form', array(1)),
'access callback' => TRUE,
);
$items['add/point-of-contact/%'] = array(
'title' => t('Add a Point of Contact'),
'page callback' => 'sponsor_school_page_add_poc_form',
@allgood2386
allgood2386 / gist:7914430
Created December 11, 2013 17:06
How to embed a view via hook_node_view
<?php
function mymodule_node_view($node){
switch($node) {
case $node->nid == 'the node id here':
$node['someLogicalNameHere'] = array (
'#type' => 'markup',
'#markup' => views_embed_view($viewName, $display_name);
//to get view name click on edit in views_ui and select your display, the url will have the following format:
// admin/structure/views/view/$viewName/edit/$display_name
//if you want to change the $display_name click advanced in the view and look for machine name about halfway down. Care
<?php
$last_page_visited = $_SERVER['HTTP_REFERER'];
if(preg_match('/order-step1/', $last_page_visited) && preg_match('/cart/', current_path()))
{
drupal_goto($path = 'order-step2');
}
?>