Skip to content

Instantly share code, notes, and snippets.

View greggles's full-sized avatar

Greg Knaddison greggles

View GitHub Profile
@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 / -
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 |
+----------+--------+---------------+
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
4889 0
1343 1
2909 2
5251 3
730 4
1392 5
907 6
720 7
653 8
294 9
@greggles
greggles / -
Created September 13, 2013 16:43
SELECT CONCAT(table_schema, '.', table_name), CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA, CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx, CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size, ROUND(index_length / data_length, 2) idxfrac FROM information_schema.TABLES ORDER BY data_length + index_length DESC LIMIT 10;
@greggles
greggles / -
Created September 13, 2013 16:34
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
+--------+--------+----------------------------+
| status | weight | name |
+--------+--------+----------------------------+
| 1 | 3 | project_verify_package |
| 1 | 3 | project_package |
| 1 | 2 | project |
| 1 | 2 | project_release |
| 1 | 0 | project_usage |
| 1 | 0 | project_dependency |
| 1 | 0 | project_git_instructions |
<?php
function project_issue_preprocess_page(&$vars) {
if (isset($vars['node']) && ($vars['node']->type == 'project_issue')) {
$vars['head_title'] = '#' . $vars['node']->nid . ': ' . $vars['head_title'];
}
}
@greggles
greggles / querypathv2.php
Created September 14, 2012 02:44
Some example querypath code
<?php
function monkey_add_origin($request) {
$request->top('MonkeyXMLRequest')
->append('<Origin></Origin>')
->children('Origin')
->append('<OriginType>ExtAPI</OriginType>');
}
// What's the new way of doing this?