Skip to content

Instantly share code, notes, and snippets.

View greggles's full-sized avatar

Greg Knaddison greggles

View GitHub Profile
date
/usr/bin/drush @cap.l sql-drop -y
bunzip2 -c /Users/greggles/db/card_db_backups/card.prod_backup_post_sanitize_latest.sql.bz2 | /usr/bin/drush @cap.l sqlc
compass compile /Users/greggles/workspace/cap/sites/all/themes/atelerix/
/usr/bin/drush @cap.l cc all
/usr/bin/drush @cap.l dis -y paranoia
/usr/bin/drush @cap.l php-eval "user_role_grant_permissions(1, array('access devel information'));"
/usr/bin/drush @cap.l php-eval "user_role_grant_permissions(2, array('access devel information'));"
/usr/bin/drush @cap.l updb -y
date
date
/usr/bin/drush @cap.l sql-drop -y
bunzip2 -c /Users/greggles/db/card_db_backups/card.prod_backup_post_sanitize_latest.sql.bz2 | /usr/bin/drush @cap.l sqlc
compass compile /Users/greggles/workspace/cap/sites/all/themes/atelerix/
/usr/bin/drush @cap.l cc all
/usr/bin/drush @cap.l dis -y paranoia
/usr/bin/drush @cap.l php-eval "user_role_grant_permissions(1, array('access devel information'));"
/usr/bin/drush @cap.l php-eval "user_role_grant_permissions(2, array('access devel information'));"
/usr/bin/drush @cap.l updb -y
date
@greggles
greggles / -
Created October 11, 2013 17:13
d.o users as of nowish
mysql> select count(1), status, length(login) from users group by status, length(login);
+----------+--------+---------------+
| count(1) | status | length(login) |
+----------+--------+---------------+
| 7062 | 0 | 1 |
| 86379 | 0 | 10 |
| 483270 | 1 | 1 |
| 1000229 | 1 | 10 |
+----------+--------+---------------+
@greggles
greggles / gist:7251874
Created October 31, 2013 15:37
Untested, but should be better for SEO than the current 404 we're giving on all pages. 307 is "the original request was fine, but temporarily please repeat the request to a new place" http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/index\.html$
RewriteRule ^(.*)$ https://drupal.org/index.html [R=307,L]
@greggles
greggles / -
Last active January 2, 2016 12:19
<?php
// Query code from http://drupalcode.org/project/project.git/blob/refs/heads/7.x-2.x:/usage/includes/pages.inc#l76
$query = db_select('node', 'n')
->fields('n', array('nid', 'title'))
->condition('n.nid', $usage_week_nids, 'IN')
->condition('n.status', NODE_PUBLISHED)
->groupBy('n.nid')
->groupBy('n.title')
@greggles
greggles / cant-wait-to-fly.html
Last active August 29, 2015 13:56
interstitials. are. AWESOME.
<html>
<head>
<title>Do you like interstitials for no reason? I do.</title>
</head>
<body>
<img src="http://www.united.com/travel/checkin/img/waitspinner.gif">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="647" height="430" id="FrontierInterstitial" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="FrontierInterstitial.swf" />
@greggles
greggles / gist:9111509
Last active August 29, 2015 13:56
security for site builders
* Limit exposure
* Defense in depth
1. Recognizing issues
2.
3. Modules, Themes, Custom code
1. Only use what you need
drush -r /var/www/security.drupal.org/htdocs sqlq "select 'unassigned issues: ', count(1) from project_issues p INNER JOIN project_issue_state pis ON p.sid = pis.sid where assigned = 0 and pis.default_query = 1;"
drush -r /var/www/security.drupal.org/htdocs sqlq "select 'issues younger than a year: ', count(1) from project_issues p INNER JOIN project_issue_state pis ON p.sid = pis.sid INNER JOIN node n on p.nid = n.nid where pis.default_query = 1 and n.created > unix_timestamp() - 60*60*24*365;"
drush -r /var/www/security.drupal.org/htdocs sqlq "SELECT 'average cycle time: ', SUM(CASE pis.default_query WHEN 1 THEN unix_timestamp() WHEN 0 THEN n.changed END - n.created) / (COUNT(1) * 60*60*24) AS duration2 FROM project_issues p INNER JOIN node n ON n.nid = p.nid INNER JOIN project_issue_state pis ON p.sid = pis.sid WHERE n.status = 1 AND p.sid > 1 AND p.pid NOT IN (77, 738) ORDER BY n.created desc;"
Feature: Anything is possible
In order to do anything at zombocom
As someone who has not yet attained the unknown
I need to be able to zombocom
@know
Scenario: Know the unattainable
Given I go to "http://www.zombo.com/"
Then the response should contain "embed src=\"inrozxa.swf\""
@greggles
greggles / gist:af800b3abaea2f82e476
Last active August 29, 2015 14:02
Proposed PCI project page text
This module allows Drupal to store, process, and/or transmit cardholder data to a payment gateway/processor. Therefore, enabling this module requires the site to comply with <em><a href="https://www.pcisecuritystandards.org/security_standards/index.php">PCI-DSS</a><em>.