Skip to content

Instantly share code, notes, and snippets.

View khalidahmada's full-sized avatar

Ahmada Khalid khalidahmada

  • Digitz
  • Agadir ,Morroco
View GitHub Profile
@khalidahmada
khalidahmada / get.js
Last active July 3, 2019 08:32
Lodash get with optional expression
import { get } from "lodash";
function __get(obj, val, def) {
const items = val.split("|");
if (!items.length) return _.get(obj, val, def);
const tpl = items.shift();
let value;
let index = 0;
while (!value && index < items.length) {
value = get(obj, `${tpl}.${items[index]}`);
@khalidahmada
khalidahmada / media-query.css
Created September 21, 2018 15:10 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@khalidahmada
khalidahmada / wp-mailhog-config-smtp.php
Created August 10, 2018 11:14
Config Wordpress SMTP for MailHog - test your emails local
/*
* Add the MailHog to your wordpress projects
* By Khalid Ahmada
* MailHog @see https://github.com/mailhog/MailHog
*/
class WP_MAILHOG
{
function __construct()
@khalidahmada
khalidahmada / wcf7-prevent-submits.js
Last active August 9, 2018 08:11
Contact Form 7 - Javascript snippet to prevent the multiples submits forms
(function($){
var wpcf7Elm = document.querySelector( '.wpcf7' );
function handlerEventProcess(event){
var hiddensubmit = $(wpcf7Elm).find('form').find('.js-hide-bloc');
if(hiddensubmit.length){
hiddensubmit.removeClass('js-hide-bloc');