Skip to content

Instantly share code, notes, and snippets.

@mohdsayed
mohdsayed / snippet.js
Last active August 10, 2016 18:00
Convert setting id to class
var settingId = '[post][id]'
var className = settingId.replace( /]/g, '' ).split( '[' ).filter(Boolean).join( '-' );
// Makes it post-id
@mohdsayed
mohdsayed / jQuery.js
Last active October 26, 2019 02:35
Get events attached to an element #javascript
//Check events attached to an element
jQuery._data( jQuery('.selector')[0], "events" );
@mohdsayed
mohdsayed / a.md
Created October 27, 2016 14:27 — forked from ericandrewlewis/a.md
The WordPress Customizer

The WordPress Customizer

The WordPress Customizer is an interface for drafting changes to content while previewing the changes before they are saved. This is an alternative to the "save and suprise" model of changing settings without knowing what exactly will happen.

The customizer can be accessed in the admin interface under Appearance > Customize.

A screenshot of the customizer

#19909 is the trac ticket that introduced the Customizer during the 3.4 release cycle.

@mohdsayed
mohdsayed / bash-cheatsheet.sh
Last active October 26, 2019 02:32 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems #bash
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@mohdsayed
mohdsayed / ac-injector.js
Created March 1, 2018 05:55
ac-injector
(function( $ ){
class ACExtenstion {
constructor() {
this.$timeGroups = $( '.tracking_objects_list_group' );
this.addTotal()
}
addTotal() {
const _this = this;
@mohdsayed
mohdsayed / fetch.js
Last active January 24, 2020 04:15
Fetch request for REST API
// Exported from php.
const exports = {
restBase: {
url: 'https://example.org/wp-json/wp/v2',
nonce: '3433DFE2',
}
};
// Utils function.
const getRestUrl = ( endpoint, params ) => {
@mohdsayed
mohdsayed / MegaMenu.js
Created February 5, 2021 06:31
Focus Trap
export default class MegaMenu {
constructor( el ) {
this.el = el;
this.inputs = [ ... this.el.querySelectorAll( 'input' ) ];
this.container = document.documentElement;
this.inputs.forEach( input => {
input.addEventListener( 'focus', () => this.handleFocus( input ) );
} );
@mohdsayed
mohdsayed / chrome.devtools.network.getHAR.json
Last active July 18, 2023 02:32
Output of chrome.devtools.network.getHAR JSON
{
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.36"
},
"pages": [],
"entries": [
{
"_initiator": {