This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch -n1 'mysql -uUSER -pPASSWORD --execute="SHOW PROCESSLIST"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Put this css in your subtheme css */ | |
/* Bootstrap admin menu fix */ | |
.logged-in #admin-toolbar ul.menu li a, | |
.logged-in div#admin-toolbar.vertical div.admin-tab { | |
height: 26px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT fm.filename | |
FROM file_managed AS fm | |
LEFT OUTER JOIN file_usage AS fu | |
ON ( fm.fid = fu.fid ) | |
LEFT OUTER JOIN node AS n | |
ON ( fu.id = n.nid ) | |
WHERE (fu.TYPE = 'node' OR fu.TYPE IS NULL) | |
AND n.nid IS NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($, Drupal) { | |
Drupal.behaviors.refresh = { | |
attach: function(context, settings) { | |
var app = angular.module('app', []); | |
app.controller('appController', function($scope, Poller) { | |
$scope.data = Poller.data; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Crawl the sitemap.xml for 301 redirections and 404 errors. | |
* Source: http://edmondscommerce.github.io/php/crawl-an-xml-sitemap-quality-check-301-and-404.html | |
* | |
* To use this script you need to allocate a huge amount of time to maximum_execution_time to | |
* avoid Fatal error: Maximum execution time...I suggest to run this script on terminal. | |
* Ex: $ php test-xml.php > ~/Desktop/sitemap-curl-result.txt | |
* | |
* For 3000 links the average time the script consumed is around 45 minutes to 1 hour. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install php-pear | |
$ sudo pear channel-discover pear.drush.org | |
$ sudo pear install drush/drush | |
$ sudo drush | |
$ sudo chown -R $USER:$USER ~/.drush |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('selector', context).bind("DOMSubtreeModified", function() { | |
// Do something. | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Note: If the image is still missing just rerun this script until the cached has been cleared. | |
* | |
* To use this script either you can run this via terminal or browser. | |
* To run this in a terminal: | |
* $ php facebook.util.php [URL] | |
* | |
* To use the browser just put the URL in the text field. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_menu(). | |
*/ | |
function my_custom_module_menu() { | |
$items = array(); | |
$items['admin/config/custom'] = array( | |
'title' => 'Custom Settings', | |
'description' => 'App custom settings.', | |
'weight' => -30, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function about_us_fetch_image() { | |
$image_url = NULL; | |
$fid = variable_get('about_us_image', ''); | |
if (is_numeric($fid) && $fid > 0) { | |
$file = file_load($fid); | |
$dest_uri = 's3://about-us-resized.jpg'; | |
// Check if the target image exists. If not, build it. | |
if (!file_exists($dest_uri)) { | |
// Copy the image. | |
file_copy($file, $dest_uri, FILE_EXISTS_REPLACE); |