Skip to content

Instantly share code, notes, and snippets.

View kadimi's full-sized avatar
I love programming...

Nabil Kadimi kadimi

I love programming...
View GitHub Profile
# Xdebug aliases
alias xdebug_on='sudo phpenmod xdebug; sudo service php7.0-fpm restart;'
alias xdebug_off='sudo phpdismod xdebug; sudo service php7.0-fpm restart;'
@kadimi
kadimi / mime.php
Created June 4, 2016 01:26
Codinggame | MIME types solution in PHP
<?php
// Number of elements which make up the association table.
fscanf(STDIN, "%d", $N);
// Number Q of file names to be analyzed.
fscanf(STDIN, "%d", $Q);
// File extensions to MIME types assosciations
$ext_to_MIME = array();
@kadimi
kadimi / better-links.js
Last active October 8, 2016 15:05
Simple solution to improve links click behaviour with jQuery by scrolling to hash removing useless page refresh when clicking on same page links.
@kadimi
kadimi / wp-cli-install.sh
Last active October 29, 2023 06:46
Install WordPress with WP-CLI (for Scotch Box)
# CD to the document root.
cd /var/www/public/
# Update WP-CLI if needed.
sudo wp cli update --allow-root --yes
# Download WordPress if needed.
wp core download
# Create configuration file.
@kadimi
kadimi / install-packer-builder-vagrant.sh
Last active February 24, 2017 22:11
packer-builder-vagrant Linux & Mac Installer
#!/usr/bin/env bash
#
# `packer-builder-vagrant` Insaller (Linux and Mac)
# =
#
# Description
# ==
#
# Script to install or update [packer-builder-vagrant](https://github.com/themalkolm/packer-builder-vagrant).
@kadimi
kadimi / wp-cli-backup.sh
Created May 26, 2017 18:56
wp-cli-backup.sh
#!/usr/bin/env bash
D='wp-content/backup';
mkdir -p $D;
wp db export $D/"`date +"db-%s-%F-%H-%M-%S.sql"`" --add-drop-table
/**
* Author: Heather Corey
* jQuery Simple Parallax Plugin
* https://www.bootply.com/zrATdhAKBZ
*/
(function($) {
$.fn.parallax = function(options) {
@kadimi
kadimi / wc-bp.php
Last active October 14, 2017 09:31
Codeable #64026 - compatibble with WooCommerce 2.6.4 and 3.x
<?php
/**
* The message sender ID (0 for current user).
*/
define('CA64026_SENDER_ID', 1);
/**
* What username to use for guests.
*/
@kadimi
kadimi / make-wp-pot.sh
Last active October 9, 2018 17:00
Shell command to create pot file for WordPress themes or plugins
find . -iname "*.php" | xargs xgettext \
--language=PHP \
--package-name=Example \
--package-version=1.0.0 \
--from-code=UTF-8 \
--keyword="__" \
--keyword="__ngettext:1,2" \
--keyword="__ngettext_noop:1,2" \
--keyword="_c,_nc:4c,1,2" \
--keyword="_e" \
@kadimi
kadimi / wp-override-permalinks.php
Last active November 3, 2017 00:27
Override Permalink Structure in WordPress