Skip to content

Instantly share code, notes, and snippets.

View juampynr's full-sized avatar

Juampy NR juampynr

View GitHub Profile
$ git diff
diff --git a/prepare_dir.sh b/prepare_dir.sh
index 69b122d..ebb9e8c 100755
--- a/prepare_dir.sh
+++ b/prepare_dir.sh
@@ -85,7 +85,7 @@ MESSAGE="Checked out a new branch for this pull request, and merged it to $MERGE
# If this the merge branch is not master, also merge to master to be sure all
# work is combined.
-if [[ "$MERGE_BRANCH" -ne "master" ]]; then
5f37bb91 (Dave Reid 2011-08-12 09:19:12 -0500 367) }
a83b0c82 (Dave Reid 2012-03-27 19:22:59 -0500 368)
8f0209d0 (colan 2012-11-03 20:36:51 -0400 369) // Get all translations of tag data for this entity.
6fbd22a5 (Damien McKenna 2013-12-31 19:10:23 -0500 370) $result = db_query("SELECT entity_id, revision_id, language, data FROM {metatag} WHE
1ee36b5c (Damien McKenna 2013-03-04 07:44:23 -0500 371) ':type' => $entity_type,
1ee36b5c (Damien McKenna 2013-03-04 07:44:23 -0500 372) ':ids' => $entity_ids,
f911e5c0 (Damien McKenna 2013-07-24 15:11:23 -0400 373) ));
8f0209d0 (colan 2012-11-03 20:36:51 -0400 374)
8f0209d0 (colan 2012-11-03 20:36:51 -0400 375) // Marshal it into an array keyed by entity ID. Each value is an array of
8f0209d0 (colan 2012-11-03 20:36:51 -0400 376) // translations keyed by language code.
@juampynr
juampynr / checklist.md
Last active August 29, 2015 14:01
DrupalCamp Spain 2014 Checklist http://2014.drupalcamp.es
@juampynr
juampynr / gist:27cdd7f5c358ac9ec1fa
Last active August 29, 2015 14:02
Upgrading Drupal core and contrib

Pre-upgrade steps:

# Start by fetching production's database.
drush syncdb @prod @local

# Make sure your main branch is up to date:
git checkout master
git pull --rebase
@juampynr
juampynr / move.sh
Created September 3, 2014 09:55
Move site within sites directory
cd sites/example
drush -v sqlq 'UPDATE system SET filename = REPLACE(filename, "example", "example2")'
mv sites/example sites/example2
drush rr -v # This is Registry Rebuild Drush command
# Then, browse your code and search for URLs containing sites/example.
@juampynr
juampynr / mymodule.php
Last active August 29, 2015 14:07
Database update with Batch API template
<?php
/**
* @file mymodule.install
* Install hooks for mymodule.
*/
/**
* Description of what the database update does. Do not use "Implements..." since it adds
* zero information and makes reading the list of pending database updates in Drush harder
* to read.
@juampynr
juampynr / gist:60d5134a2555a3eaeec4
Last active August 29, 2015 14:07
Check database table size
SELECT TABLE_NAME, table_rows, data_length, index_length, round(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "mydatabase" ORDER BY round(((data_length + index_length) / 1024 / 1024),2) DESC
LIMIT 0,15;
function drush_pm_compare($alias_a, $alias_b) {
$result_a = drush_invoke_process($alias_a, 'pm-list')
$result_b = drush_invoke_process($alias_b, 'pm-list')
// Compare both arrays and inform about differences
}
// CasperJS default settings.
$command_specific['casperjs'] = array(
'verbose' => TRUE,
'url' => 'http://local.mysite.com',
'test-root' => '../testing/tests',
'includes' => '../testing/users.js,../testing/common.js',
);
@juampynr
juampynr / skip.js
Last active August 29, 2015 14:17
CasperJS skip third party requests
/**
* Skip third party resources from being requested.
*
* Usage: add this file to casper js at the --includes option.
* Edit the array of URLs to skip.
* You can find out which third party requests your pages are making
* by adding the option --log-level=debug to the casperjs command.
*/
casper.on('resource.requested', function(requestData, request) {
// List of URLs to skip. Entering part of a hostname or path is OK.