Skip to content

Instantly share code, notes, and snippets.

View stovak's full-sized avatar
😀

Tom Stovall stovak

😀
View GitHub Profile
@stovak
stovak / gist:1343996
Created November 7, 2011 01:48
Touch events for jQuery Cycle
Drupal.settings.isTouchDevice = function() {
return "ontouchstart" in window;
}
if ( Drupal.settings.isTouchDevice() ) {
Drupal.behaviors.jQueryMobileSlideShowTouchAdvance = {
attach: function(context, settings) {
self = Drupal.behaviors.jQueryMobileSlideShowTouchAdvance;
jQuery.each(jQuery(".views_slideshow_cycle_main.viewsSlideshowCycle-processed"), function(idx, value) {
value.addEventListener("touchstart", self.handleTouchStart);
@stovak
stovak / gist:1380472
Created November 20, 2011 16:50
RightScript to install LAMP/drush/Drush make
#!/bin/bash -ex
logger -t RightScale "\n\nStarting Script..."
/usr/bin/apt-get update
logger -t RightScale "\n\nApt-Get Update..."
/usr/bin/apt-get -y -q upgrade
logger -t RightScale "\n\nAutoremove/Autoclean..."
/usr/bin/apt-get autoremove
@somecolor = #ff4300;
h1 {
background: transparent url("data:image/svg+xml;utf8,<svg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' width='21.038px' height='8.001px' viewBox='89.624 95.333 21.038 8.001' enable-background='new 89.624 95.333 21.038 8.001' xml:space='preserve'><polygon fill='@{somecolor}' points='110.662,95.333 100.144,103.334 89.624,95.333 '/></svg>") no-repeat 0px 50px;
a { background: transparent @logoimage no-repeat -3px center; }
}
@stovak
stovak / pre_post_less.patch
Created April 25, 2012 02:35
patch drupal less module with pre and post process hooks
diff --git a/less.module b/less.module
index 20c27317ba2be24b139a0a193dcaa4cad6694ff2..5c269ed4405c66171eb526048cdded2727d0f236 100644
--- a/less.module
+++ b/less.module
@@ -107,7 +107,21 @@ function _less_pre_render($styles) {
$data = preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\s*\)/i', '_drupal_build_css_path', $contents);
try {
- $output_data = $less->parse($data);
+ $mods = module_implements("less_css_preprocess");
@stovak
stovak / example.make
Created October 9, 2012 22:02
generate-makefile example.make
; This file was auto-generated by drush make
core = 7.x
api = 2
projects[drupal][version] = "7.x"
; Modules
projects[accordion_menu][subdir] = "contrib"
projects[accordion_menu][version] = "1.1"
@stovak
stovak / gist:4068794
Created November 13, 2012 22:14
Test Solr Server Creation.
public function testCreateDestroy() {
$ssh = new \Apigee\Shiva\SolrProvisioner();
$server = $ssh->getServer("dit");
for($x=0; $x < 10 ; $x++) {
$name = "Unit-Test-".$this->randomName(8);
$ssh->create("dit", $name);
$response = $this->curlIt("http://".$server->hostname);
$this->assertTrue((strlen(response['raw']) > 0 && strpos($response['raw'], $name)), "Solr should list org the newly-created organization in its list.");
$ssh->destroy("dit", $name);
$response = $this->curlIt("http://".$server->hostname);
<?php
echo php_uname('s');/* Operating system name */
echo "<br />";
echo php_uname('n');/* Host name */
echo "<br />";
echo php_uname('r');/* Release name */
echo "<br />";
echo php_uname('v');/* Version information */
echo "<br />";
The file /etc/hosts controls the "known" hosts to your mac. You can hijack a website and tell it to use a specific server by defining a websites IP address in your /etc/hosts.
Open a terminal session on your mac and type:
`sudo nano /etc/hosts`
Hit the down arrow until you get to the end of the file.
Entries in /etc/hosts take the following syntax
#!/bin/bash
echo "Downloading Cert from fedoraproject...\n"
rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm >> /tmp/apigee-drupal-install.log
echo "Installing Packages from various repos (this may take a few minutes)...\n"
sudo yum install -y httpd mysql mysql-server git php php-mysql php-xml gd gd-devel php-gd php-pear ImageMagick ImageMagick-devel >> /tmp/apigee-drupal-install.log
echo "Restarting Apache...\n"
sudo service httpd start >> /tmp/apigee-drupal-install.log
#!/bin/sh
export LOGFILE="/tmp/apigee-drupal-install.log"
export DRUPAL_WEBAPP="/var/www/html"
export DOCS_DB_SOURCE="/tmp/apigee-drupal/db/docs_r20_2013-03-13.sql"
export DOCS_HOSTNAME="docs.local"
export PORTAL_DB_SOURCE="/tmp/apigee-drupal/db/portal_r20_2013-03-13.sql"
export PORTAL_HOSTNAME="portal.local"