Skip to content

Instantly share code, notes, and snippets.

View saadwaseem's full-sized avatar

Saad Waseem saadwaseem

View GitHub Profile
Infinite Scrolling for FAQs page. This sample code can be modified to handle infinite scrolling on any page for any type
content Text, Media etc.
/*
* Faqs load on scroll.
*/
var track_page = 1; //track user scroll as page number, right now page number is 1
var loading = false;
$('.load-more-faqs').hide();
if ($('body').hasClass('tax-faqs_category')) {
@saadwaseem
saadwaseem / Dockerfile
Created June 22, 2018 14:28
Dockerfile for Drupal 8 Apache
From drupal:8.5-apache
RUN apt-get update && apt-get install -y \
curl \
git \
mysql-client \
vim \
wget
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php composer-setup.php && \
mv composer.phar /usr/local/bin/composer && \
@saadwaseem
saadwaseem / Setting up Docker on windows 8.1
Created June 22, 2018 14:25
Install Docker on windows 8.1
To set up Docker on windows follow the instructions given in the following link:
https://docs.docker.com/toolbox/toolbox_install_windows/#step-2-install-docker-toolbox
1- Then go to your desktop and right click the 'Docker quick start terminal' and open properties. From there change
the target field and point it to your git bash.exe file press enter to save your settings.
2- To run the Docker client use CMD and go to : C:\program files\docker toolbox
enter start.sh into your terminal and press enter
Hope! You are good to go with your Docker installation.
@saadwaseem
saadwaseem / export_all.sh
Created May 21, 2018 10:13
Export all Databases in separate files.
#!/bin/bash
USER="YOUR USER NAME"
PASSWORD="YOUR PASSWORD"
ExcludeDatabases="Database|information_schema|performance_schema|mysql"
databases=`mysql -u $USER -p $PASWORD -e "SHOW DATABASES;" | tr -d "| " | egrep -v $ExcludeDatabases`
for db in $databases; do
echo "Dumping database: $db"
mysqldump -u $USER -p$PASSWORD --databases $db > `date +%Y%m%d`.$db.sql
@saadwaseem
saadwaseem / cat_search.txt
Created April 5, 2018 22:25
Online Shop Wordpress theme by ACME Themes: Category does not work while searching for products.
Add following function to your theme's function.php and category will be counted while searching for products.
/**
* Adds Category taxonomy query to WP search query
* This addition will make the search more relevant
* @param type $query
*/
function search_filter($query) {
if($query->is_search()) {
// category terms search.