Get Drush to run Drupal cron regularly using crontab

Drush can Drupal cron without the need of accessing http://www.yoursite.com/cron.php?cron_key=<key>. This means we can safely remove or redirect cron.php to 404 Not Found in our .htaccess:

  
RewriteRule cron.php / [R=404,L]
  

To make our crontab script simple, we will use Drush's site aliases. Example if we are running multiple sites in our server: yoursite1.com, yoursite2.com and yoursite3.com we can assign alias @site1, @site2 and @site3 respectively. To do this:

Tags

How to fix inaccessible flash drive identified by computer as "USB Disk 30X USB Device"

Having a bootable Linux on flash drive is very handly tool for a web developer. When I was about to create one, my TDK 16GB flash drive becomes inaccessible in my Windows 7 file explorer. The Windows explorer detected it and shows "Removable drive (H:)". When I clicked the drive, it prompted me to insert a disk in Drive H: as if it were acting as a CD or DVD drive. I checked it on my "Device Manager" and found my flash drive registered as "USB Disk 30X USB Device". I tried some known fix: uninstalled/re-installed the drive's device driver, re-assigned new Drive letter and nothing worked.

Setup Rock Mongo web interface

I was looking for a admin web interface for mongoDB just like PHPMyAdmin for My SQL and found RockMongo a good one. In this article will show how to setup RockMongo using the authentication created in your mongoDB service. Please checkout this article Setup Drupal 7 Panopoly distribution with mongoDB on CentOS 7 if you haven't setup your mongoDB service and its PHP driver in your server.

Using SASS breakpoint mixin

One of the SASS mixins that I used a lot is the breakpoint. It makes the media queries in SASS simple and elegant. But first get the mixin at https://github.com/at-import/breakpoint. We can now write our media queries in SASS in the following manner:

  
@import "stylesheets/breakpoint";
.menu {
  @include breakpoint($screen-xs) { 
    font-size: 1em;
  }
  font-size: 1.4em;
}
  

The CSS output:

Adding autocomplete to custom Drupal form using Search API autocomplete module's API

The Search API autocomplete module works well on views page with exposed filter form but we know that views exposed filter form generates less clean URL for its filtered page. Using views contextual filter is the quick way to solve clean URL issue but it requires to develop your own custom search form to pass the query to this views contextual filter. This article will show how to add autocomplete feature to custom Drupal form where data shown in dropdown suggestions are pulled from Search API index using Search API autocomplete module's API.

Drupal Search API Solr spellcheck setup for foreign language

The task is to setup the spellcheck feature of Solr in Drupal for foreign language (in this article I will demonstrate enabling German language and adding new language - Filipino). The Solr spellcheck is a feature where it gives list of suggestions if there is no search result due to spelling error.

Setup short and easy to remember URL for multi-site in Windows local PC

When developing on multi-site in our local development environment we wanted a short and easy to remember URL for each site. We will take a look on how to setup http://webfoobar and http://myotherwebsite address for our sites. The following instructions are for Windows with XAMPP web server solution stack package.

Efficient way to target the outer HTML element in jQuery

Given the HTML structure below. The goal is to modify the inner text of closest outer div tag with "log" class when an anchor tag is clicked. For example when the anchor tag with content "3a" is clicked, the div tag with "log" class inside the div wrapper with "content-a" class inner text should have a value of "3a clicked".

HTML: