Skip to content

Instantly share code, notes, and snippets.

View glennpratt's full-sized avatar

Glenn Pratt glennpratt

View GitHub Profile
@glennpratt
glennpratt / fastcgi_params
Created May 27, 2011 03:37
/etc/nginx/fastcgi_params
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
@glennpratt
glennpratt / gist:1016744
Created June 9, 2011 13:40
DateTime.php
$ php -a
Interactive shell
php > $date = new DateTime('now');
php > $timestamp = $date->format('U');
php > var_dump($timestamp);
string(10) "1307626589"
php > $timestamp = $date->getTimestamp();
php > var_dump($timestamp);
int(1307626589)
@glennpratt
glennpratt / include.rb
Created June 20, 2011 18:05
include.rb
if (![2,3].include? location['province'].length)
raise 'Invalid State/Province Code. Must be 2 or 3 char. See Drupal location.module'
else
# Generate a password meeting policy standards.
pass = ((0...8).map{ (('a'..'z').to_a + ('A'..'Z').to_a + ('2'..'9').to_a)[rand(60)] } + (0...2).map{ (('a'..'z').to_a)[rand(26)] } + (0...2).map{ (('A'..'Z').to_a)[rand(26)] } + (0...2).map{ (('2'..'9').to_a)[rand(8)] } + (0...2).map{ (['!','$','&','@'])[rand(4)] }).shuffle.join
@glennpratt
glennpratt / dev.rb
Created June 30, 2011 23:22
dev.rb
require 'json'
# User information for ec2 key pair.
set :user, 'ubuntu'
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "devallplayerscom.pem")]
# Get app server nodes in this environment.
data = JSON.parse(`knife search node "chef_environment:dev AND tags:app" -F json -a cloud.public_hostname`)
app_servers = []
data['rows'].each {|row| app_servers << row['cloud.public_hostname']}
[Thu, 28 Jul 2011 13:17:22 -0500] DEBUG: template[/etc/memcached.conf] content has not changed.
[Thu, 28 Jul 2011 13:17:22 -0500] DEBUG: Processing package[imagemagick] on vagrantup.com
[Thu, 28 Jul 2011 13:17:22 -0500] INFO: Processing package[imagemagick] action install (imagemagick::default line 24)
[Thu, 28 Jul 2011 13:17:22 -0500] DEBUG: Checking package status for imagemagick
[Thu, 28 Jul 2011 13:17:22 -0500] DEBUG: sh(aptitude show imagemagick)
Package: imagemagick
New: yes
State: not installed
Version: 7:6.5.7.8-1ubuntu1.1
Priority: optional
diff --git a/www/modules/user/user.pages.inc b/www/modules/user/user.pages.inc
index 748f08c..e5f7e5b 100644
--- a/www/modules/user/user.pages.inc
+++ b/www/modules/user/user.pages.inc
@@ -293,10 +293,6 @@ function user_profile_form_submit($form, &$form_state) {
// Clear the page cache because pages can contain usernames and/or profile information:
cache_clear_all();
- if (user_access('select different theme')) {
- // This prevents the system theme from getting corrupted.
<?php
if ($rc != 'local') {
// Need SauceLabs PEAR.
include_once 'PHPUnit/Extensions/SeleniumTestCase/SauceOnDemandTestCase.php';
class SeleniumWrapper extends PHPUnit_Extensions_SeleniumTestCase_SauceOnDemandTestCase {
// @TODO - Allow this list to be configured.
public static $browsers = array(
array(
@glennpratt
glennpratt / PHPUnitSharedSeleniumSession.php
Created August 18, 2011 18:14
Run PHPUnit Selenium test methods with out closing the session, except between classes.
<?php
class SeleniumTestHelper extends PHPUnit_Extensions_SeleniumTestCase {
protected $sharedSession = FALSE;
/**
* @throws RuntimeException
*/
protected function runTest()
{
@glennpratt
glennpratt / mac.json
Created August 31, 2011 16:11
mac.json
{
"name:": "gpratt_mbp",
"role": "drupal_database_master",
"chef_environment": "_default",
"fqdn": "10.234.90.1"
}