Skip to content

Instantly share code, notes, and snippets.

View AmmarCodes's full-sized avatar

Ammar Alakkad AmmarCodes

View GitHub Profile
@AmmarCodes
AmmarCodes / README.md
Last active March 20, 2024 21:04
WordPress: link to specific elementor tab on a specific page

It's a quick ad-hoc solution to allow you to link to your page to a specific tab from elementor tabs widget.

Here's the catch, you need to replace the id of the specific tab you want to use to not contain the title- part.

Use https://your-website/#elementor-tab-1515

instead of: https://your-website/#elementor-tab-title-1515

@AmmarCodes
AmmarCodes / window.confirm.js
Created December 10, 2019 13:14
Mock window.confirm in Jest
describe('mocking window.confirm', () => {
// mock window.confirm
let windowSpy;
beforeEach(() => {
windowSpy = jest.spyOn(global, 'window', 'get');
windowSpy.mockImplementation(() => ({
confirm: () => {},
}));
});
afterEach(() => {
SELECT
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema = "DATABASE"
USERNAME=
PASSWORD=
DBNAME=
QUERY_FILE_NAME=
mysql -u $USERNAME -D $DBNAME -p$PASSWORD -B < $QUERY_FILE_NAME | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > $QUERY_FILE_NAME.csv
USERNAME=
PASSWORD=
DBNAME=
mysqldump -u $USERNAME -p$PASSWORD $DBNAME | gzip > $DBNAME.sql.gz
SELECT TABLE_NAME, TABLE_ROWS FROM `information_schema`.`tables` WHERE `table_schema` = 'DATEBASE_NAME';
### Keybase proof
I hereby claim:
* I am aalakkad on github.
* I am aalakkad (https://keybase.io/aalakkad) on keybase.
* I have a public key whose fingerprint is BDEE 6F73 01FF 7396 02FB 530A FC2F BAC8 3BD0 AD53
To claim this, I am signing this object:
import { Component } from '@angular/core';
import { ionicBootstrap } from 'ionic-angular';
import { Tab1 } from './tab1-page';
import { Tab2 } from './tab2-page';
@Component({
template: `
<ion-tabs>
<ion-tab tabIcon="heart" [root]="tab1"></ion-tab>
<ion-tab tabIcon="star" [root]="tab2"></ion-tab>
</ion-tabs>`
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
} from 'react-native';
import Tabs from 'react-native-tabs';
@AmmarCodes
AmmarCodes / phpfmt.sublime-settings
Created August 18, 2016 14:03
Sublime phpfmt package configuration
{
"passes":
[
"AlignPHPCode",
"NewLineBeforeReturn",
"AutoSemicolon",
"SmartLnAfterCurlyOpen",
"SpaceBetweenMethods",
"AlignEquals",
"AlignTypehint",